forked from liquanzhou/cedardeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manager.py
executable file
·34 lines (25 loc) · 846 Bytes
/
manager.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
34
#!/usr/bin/env python
# coding: utf-8
# python manager.py runserver
# python manager.py runserver -d -r -h 10.172.159.74 -p 5000
# python manager.py db init
# python manager.py db migrate
# python manager.py db upgrade
# python manager.py shell
# with app.app_context():
# u = User(email='[email protected]',username='admin',password='admin')
# db.session.add(u)
# db.session.commit()
from app import create_app, db
from app.models import User
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
app = create_app()
manager = Manager(app)
migrate = Migrate(app, db)
def make_shell_context():
return dict(app=app, db=db, User=User)
manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':
manager.run()