我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用flask_wtf.csrf.CSRFProtect()。
def add_blueprints(application): csrf = CSRFProtect(application) # import and register the main application blueprint from app.views.questionnaire import questionnaire_blueprint application.register_blueprint(questionnaire_blueprint) questionnaire_blueprint.config = application.config.copy() from app.views.feedback import feedback_blueprint application.register_blueprint(feedback_blueprint) feedback_blueprint.config = application.config.copy() from app.views.session import session_blueprint csrf.exempt(session_blueprint) application.register_blueprint(session_blueprint) session_blueprint.config = application.config.copy() from app.views.flush import flush_blueprint csrf.exempt(flush_blueprint) application.register_blueprint(flush_blueprint) flush_blueprint.config = application.config.copy() from app.views.dump import dump_blueprint application.register_blueprint(dump_blueprint) dump_blueprint.config = application.config.copy() from app.views.errors import errors_blueprint application.register_blueprint(errors_blueprint) errors_blueprint.config = application.config.copy() from app.jinja_filters import blueprint as filter_blueprint application.register_blueprint(filter_blueprint) from app.views.static import contact_blueprint application.register_blueprint(contact_blueprint) contact_blueprint.config = application.config.copy()