Here is how I dealt with this:
Here I initialize everything:
import logging import logging.config import flask import flask.globals as flask_global import flask_login from config import flask as flask_config from rest.api import dashboard from rest.api.util import login_decorator logger = logging.getLogger(__name__)
Here is my project with my own login handling:
from __future__ import absolute_import import flask import flask_login from flask import Blueprint from core.models.profile import Agent from core.utils import thread_local from rest.api.util import login_decorator blueprint = Blueprint('human', __name__, url_prefix='/human') def load_user(user_id): """ This will be used many times like on using current_user :param user_id: username :return: user or none """ agent = None try: agent = Agent.objects.get(username=user_id) except:
Hope this helps.
source share