def load_user(user_id): return User.query.filter_by(id=user_id).first() #N.B. Remember me cookies are for the event a user logs out accidentally #THE URL TO REDIRECTS USER TO IF THEY ARENT LOGGED IN login_manager.login_view = "loginForm" #Store the previous page that required login...and redirects user to it if true login_manager.use_session_for_next= False #Duration of the login_manager remember me session cookie login_manager.REMEMBER_COOKIE_DURATION= datetime.timedelta(minutes= 1) #Prevents client side scripts from accessing it login_manager.REMEMBER_COOKIE_HTTPONLY= False #Refreshes cookie on each request: if true login_manager.REMEMBER_COOKIE_REFRESH_EACH_REQUEST= True ''' End Flask Login Functions ''' ''' Begin boilerplate code ''' def create_app(): app = Flask(__name__, static_url_path='') app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True app.config['SECRET_KEY'] = "MYSECRET" CORS(app) db.init_app(app) login_manager.init_app(app) return app