call app.register_blueprint(blueprint) to register blue print login_manager = flask_login.LoginManager() login_manager.init_app(app)
You will need to provide a user_loader callback. This callback is used to reload the user object from the user ID stored in the session. It should take the unicode ID of a user, and return the corresponding user object. For example: @login_manager.user_loader def load_user(user_id): return User.get(user_id)
/admin has been mapped to admin_panel blue print, This defined in the blueprints.py with the following code snippet
from flask import Blueprint
def processAppBP(partial_module_string, url_prefix):
"""
:param partial_module_string: Blueprint path to python blueprint file
:param url_prefix: URI context
:return: Blueprint with information
"""
applicationName = 'UTEWebUI'
name = partial_module_string
import_name = applicationName + '.views.{}'.format(partial_module_string)
template_folder = 'templates'
blueprint = Blueprint(name, import_name, template_folder=template_folder, url_prefix=url_prefix)
return blueprint
admin_panel = processAppBP('home.index', '/admin')
base = processAppBP('base.index', '/')
all_blueprints = (admin_panel, base)