flask-nav

Accessing Flask Session variables from Flask Navigation for dynamic navigation menu

回眸只為那壹抹淺笑 提交于 2019-12-01 08:58:04
I want to have a dynamic navigation menu that shows "Login" if the user is not currently logged on, and "Logout" if the user is logged in. I'm using code similar to the following: import flask import flask_nav import flask_nav.elements as fne frontend = flask.Blueprint('frontend', __name__) application = flask.Flask(__name__) mySess = flask_session.Session() flask_appconfig.AppConfig(application) flask_bootstrap.Bootstrap(application) application.register_blueprint(frontend) application.config['BOOTSTRAP_SERVE_LOCAL'] = True application.config['SSL'] = True application.secret_key = SECRET_KEY

Accessing Flask Session variables from Flask Navigation for dynamic navigation menu

走远了吗. 提交于 2019-12-01 05:42:03
问题 I want to have a dynamic navigation menu that shows "Login" if the user is not currently logged on, and "Logout" if the user is logged in. I'm using code similar to the following: import flask import flask_nav import flask_nav.elements as fne frontend = flask.Blueprint('frontend', __name__) application = flask.Flask(__name__) mySess = flask_session.Session() flask_appconfig.AppConfig(application) flask_bootstrap.Bootstrap(application) application.register_blueprint(frontend) application