File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 11
11
app .config ['SQLALCHEMY_DATABASE_URI' ] = 'sqlite:///data.db'
12
12
app .config ['SQLALCHEMY_TRACK_MODIFICATIONS' ] = False
13
13
app .config ['PROPAGATE_EXCEPTIONS' ] = True
14
- app .secret_key = 'jose '
14
+ app .secret_key = 'vijay '
15
15
api = Api (app )
16
16
17
-
18
- @app .before_first_request
19
- def create_tables ():
20
- db .create_all ()
21
-
22
-
23
17
jwt = JWT (app , authenticate , identity ) # /auth
24
18
25
19
api .add_resource (Store , '/store/<string:name>' )
@@ -31,4 +25,9 @@ def create_tables():
31
25
if __name__ == '__main__' :
32
26
from db import db
33
27
db .init_app (app )
28
+ if app .config ['DEBUG' ]:
29
+ @app .before_first_request
30
+ def create_tables ():
31
+ db .create_all ()
32
+
34
33
app .run (port = 5000 , debug = True )
Original file line number Diff line number Diff line change
1
+ from app import app
2
+ from db import db
3
+
4
+ db .init_app (app )
5
+
6
+ @app .before_first_request
7
+ def create_tables ():
8
+ db .create_all ()
You can’t perform that action at this time.
0 commit comments