예제 #1
0
파일: app.py 프로젝트: CMGS/Sagittarius
app = Flask(__name__)
app.debug = config.DEBUG
app.secret_key = config.SECRET_KEY
app.jinja_env.filters['s_files'] = static_files
app.jinja_env.globals['get_current_user'] = get_current_user
app.jinja_env.globals['get_unread_mail_count'] = get_unread_mail_count

app.config.update(
    SQLALCHEMY_DATABASE_URI = config.DATABASE_URI,
    SQLALCHEMY_POOL_SIZE = 100,
    SQLALCHEMY_POOL_TIMEOUT = 10,
    SQLALCHEMY_POOL_RECYCLE = 3600,
    SESSION_COOKIE_DOMAIN = config.SESSION_COOKIE_DOMAIN,
)

oauth.register_blueprints(app)
app.register_blueprint(account, url_prefix='/account')
app.register_blueprint(people, url_prefix='/people')
app.register_blueprint(event, url_prefix='/event')
app.register_blueprint(mail, url_prefix='/mail')
app.register_blueprint(api, url_prefix='/api')

logger = logging.getLogger(__name__)

init_db(app)
csrf(app)
app.wsgi_app = SessionMiddleware(app.wsgi_app, \
        FilesystemSessionStore(), \
        cookie_name=config.SESSION_KEY, cookie_path='/', \
        cookie_domain=config.SESSION_COOKIE_DOMAIN)
예제 #2
0
def init_views(app):
    oauth.register_blueprints(app)
    app.register_blueprint(account, url_prefix='/account')
    app.register_blueprint(people, url_prefix='/people')
    app.register_blueprint(topic, url_prefix='/mail')
    app.register_blueprint(weixin, url_prefix='/wx')