File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import sys
4
+ import os
5
+ from cumblr import app
6
+ from cumblr .database import db , setup_database
7
+
8
+ if __name__ == '__main__' :
9
+ if '--drop' in sys .argv :
10
+ with app .app_context ():
11
+ db .drop_all ()
12
+ db .session .commit ()
13
+ print ('Database tables dropped' )
14
+ if '--clear' in sys .argv :
15
+ with app .app_context ():
16
+ db .reflect ()
17
+ db .drop_all ()
18
+ db .create_all ()
19
+ setup_database ()
20
+ db .session .commit ()
21
+ print ('Database tables dropped and recreated' )
22
+ if '--setup' in sys .argv :
23
+ with app .app_context ():
24
+ db .create_all ()
25
+ db .session .commit ()
26
+ print ('Database tables created' )
27
+ else :
28
+ host = os .environ .get ('HOST' , '0.0.0.0' )
29
+ port = int (os .environ .get ('PORT' , 5000 ))
30
+ app .run (host = host , port = port )
You can’t perform that action at this time.
0 commit comments