File tree 4 files changed +13
-8
lines changed
4 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1
1
from flask_script import Manager
2
- from tvseries import app
2
+ from tvseries import create_app
3
+ from tvseries .config import DevelopmentConfig
3
4
5
+ app = create_app (config = DevelopmentConfig )
4
6
manager = Manager (app )
5
7
6
8
if __name__ == "__main__" :
Original file line number Diff line number Diff line change 4
4
from tvseries .ext import db
5
5
from tvseries .core import core_blueprint
6
6
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):
6
6
SECRET_KEY = config ('SECRET_KEY' )
7
7
SERVER_NAME = config ('SERVER_NAME' )
8
8
SQLALCHEMY_DATABASE_URI = config ('DATABASE_URI' )
9
+ SQLALCHEMY_TRACK_MODIFICATIONS = True
9
10
DEBUG = False
10
11
TESTING = False
11
12
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ class TestCore:
9
9
10
10
@pytest .fixture
11
11
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 )
14
14
return app
15
15
16
16
def test_get_home (self , db ):
You can’t perform that action at this time.
0 commit comments