forked from alectrocute/flaskSaaS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
33 lines (21 loc) · 754 Bytes
/
manage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from flask.ext.script import Manager, prompt_bool, Shell, Server
from termcolor import colored
from app import app, db, models
manager = Manager(app)
def make_shell_context():
return dict(app=app)
@manager.command
def initdb():
''' Create the SQL database. '''
db.create_all()
print(colored('The SQL database has been created', 'green'))
@manager.command
def dropdb():
''' Delete the SQL database. '''
if prompt_bool('Are you sure you want to lose all your SQL data?'):
db.drop_all()
print(colored('The SQL database has been deleted', 'green'))
manager.add_command('runserver', Server())
manager.add_command('shell', Shell(make_context=make_shell_context))
if __name__ == '__main__':
manager.run()