本文整理汇总了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)
示例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):
示例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()