示例#1
0
# ***** register blueprints
from app.home.views import home
from app.blog.views import blog
from app.profile.views import profile
app.register_blueprint(home)
app.register_blueprint(blog)
app.register_blueprint(profile)


# figure out why the import of Moment can not be put on the top...import recursion
# from app import views, models, error_log
from app.admin.views import admin
# from helper import Moment, generate_csrf_token
#
admin.init_app(app)
# i do know where to put it...
from app import models
login_manager.anonymous_user = models.AnonymousUser

from helper import Moment
# inject Moment into the template as a global variable
app.jinja_env.globals['moment'] = Moment

# app.jinja_env.globals['csrf_token'] = generate_csrf_token


# test for context_processor
@app.context_processor
def inject_permission():
    """
示例#2
0
def register_admin(app):
    admin.init_app(app)