當前位置: 首頁>>代碼示例>>Python>>正文


Python FlaskAPI.config['SECRET_KEY']方法代碼示例

本文整理匯總了Python中flask.ext.api.FlaskAPI.config['SECRET_KEY']方法的典型用法代碼示例。如果您正苦於以下問題:Python FlaskAPI.config['SECRET_KEY']方法的具體用法?Python FlaskAPI.config['SECRET_KEY']怎麽用?Python FlaskAPI.config['SECRET_KEY']使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在flask.ext.api.FlaskAPI的用法示例。


在下文中一共展示了FlaskAPI.config['SECRET_KEY']方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: FlaskAPI

# 需要導入模塊: from flask.ext.api import FlaskAPI [as 別名]
# 或者: from flask.ext.api.FlaskAPI import config['SECRET_KEY'] [as 別名]
from flask import Flask, request, render_template
from flask.ext.api import FlaskAPI, status
from flask.ext.cors import CORS


#when we have secret keys and such turn this back on
import config

app = FlaskAPI(__name__)
app.config['SECRET_KEY'] = 'super-secret'
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
# will pull config options from config.py
#app.config.from_object(config)
開發者ID:knuevena,項目名稱:americorps-backend,代碼行數:16,代碼來源:app.py

示例2: Path

# 需要導入模塊: from flask.ext.api import FlaskAPI [as 別名]
# 或者: from flask.ext.api.FlaskAPI import config['SECRET_KEY'] [as 別名]
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager, login_user, logout_user, current_user, login_required
from flask.ext.wtf import Form

from wtforms import TextField, BooleanField
from wtforms.validators import Required
from sqlalchemy import Column, Integer, String, DateTime, Boolean, desc, ForeignKey
from unipath import Path
import bleach
import filters

TEMPLATE_DIR = Path(__file__).ancestor(1).child("templates")

app = FlaskAPI(__name__, template_folder=TEMPLATE_DIR)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['DATABASE_URL']
app.config['SECRET_KEY'] = 'you-will-never-guess'
db = SQLAlchemy(app)

lm = LoginManager()
lm.init_app(app)
lm.login_view = 'login'

filters.init_app(app)


class LoginForm(Form):
    username = TextField('username', validators = [Required()])


class User(db.Model):
開發者ID:Ogreman,項目名稱:readinglist,代碼行數:32,代碼來源:app.py

示例3: FlaskAPI

# 需要導入模塊: from flask.ext.api import FlaskAPI [as 別名]
# 或者: from flask.ext.api.FlaskAPI import config['SECRET_KEY'] [as 別名]
from flask import request
from flask.ext.api import FlaskAPI, status
import psycopg2
from psycopg2.extras import RealDictCursor
import random
import urlparse
import json


app = FlaskAPI(__name__)
app.config['SECRET_KEY'] = 'JDas8dj123e&&@0h';

urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse('postgres://dahgrmgyrvnjxh:[email protected].com:5432/d4neua8lk9eb55')

print "\n---Starting app.py"

db = psycopg2.connect(
	database=url.path[1:],
	user=url.username,
	password=url.password,
	host=url.hostname,
	port=url.port
)
print " + Opened database successfully"
cur = db.cursor(cursor_factory=RealDictCursor)

cur.execute("CREATE TABLE IF NOT EXISTS dataunits (id SERIAL PRIMARY KEY, username CHAR(20), comment CHAR(100), dataunit CHAR(256));")
print " + Table created successfully (or already existed)"
db.commit()
開發者ID:dimichelec,項目名稱:limitless-castle-6182,代碼行數:32,代碼來源:app.py


注:本文中的flask.ext.api.FlaskAPI.config['SECRET_KEY']方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。