File tree Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 11from flask_script import Manager
2- from tvseries import app
2+ from tvseries import create_app
3+ from tvseries .config import DevelopmentConfig
34
5+ app = create_app (config = DevelopmentConfig )
46manager = Manager (app )
57
68if __name__ == "__main__" :
Original file line number Diff line number Diff line change 44from tvseries .ext import db
55from tvseries .core import core_blueprint
66
7- print ("Problem: Hen and egg (python circular imports)" )
8- app = Flask (__name__ )
9- app .config .from_object (config .DevelopmentConfig )
10- app .register_blueprint (core_blueprint , url_prefix = '/' )
11- db .init_app (app )
7+
8+ def create_app (config = config .ProductionConfig ):
9+ app = Flask (__name__ )
10+ app .config .from_object (config )
11+ app .register_blueprint (core_blueprint , url_prefix = '/' )
12+ db .init_app (app )
13+ return app
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ class BaseConfig(object):
66 SECRET_KEY = config ('SECRET_KEY' )
77 SERVER_NAME = config ('SERVER_NAME' )
88 SQLALCHEMY_DATABASE_URI = config ('DATABASE_URI' )
9+ SQLALCHEMY_TRACK_MODIFICATIONS = True
910 DEBUG = False
1011 TESTING = False
1112
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ class TestCore:
99
1010 @pytest .fixture
1111 def app (self ):
12- from tvseries import app
13- app . config . from_object (TestConfig )
12+ from tvseries import create_app
13+ app = create_app (TestConfig )
1414 return app
1515
1616 def test_get_home (self , db ):
You can’t perform that action at this time.
0 commit comments