File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from flask import Flask
22
33from tvseries import config
4- from tvseries .ext import db
4+ from tvseries .ext import db , csrf
55from tvseries .core import core_blueprint
66
77
@@ -10,4 +10,5 @@ def create_app(config=config.ProductionConfig):
1010 app .config .from_object (config )
1111 app .register_blueprint (core_blueprint , url_prefix = '/' )
1212 db .init_app (app )
13+ csrf .init_app (app )
1314 return app
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ class BaseConfig(object):
1111 SQLALCHEMY_TRACK_MODIFICATIONS = True
1212 COLLECT_STATIC_ROOT = os .path .join (BASE_DIR , "static" )
1313 COLLECT_STORAGE = 'flask_collect.storage.file'
14+ WTF_CSRF_ENABLED = True
1415 DEBUG = False
1516 TESTING = False
1617
@@ -22,6 +23,7 @@ class DevelopmentConfig(BaseConfig):
2223class TestConfig (BaseConfig ):
2324 SQLALCHEMY_DATABASE_URI = 'sqlite:///tvseries-test.sqlite3'
2425 TESTING = True
26+ WTF_CSRF_ENABLED = False
2527
2628
2729class ProductionConfig (BaseConfig ):
Original file line number Diff line number Diff line change 11from flask_sqlalchemy import SQLAlchemy
2+ from flask_wtf .csrf import CsrfProtect
23
34db = SQLAlchemy ()
5+ csrf = CsrfProtect ()
You can’t perform that action at this time.
0 commit comments