-
Notifications
You must be signed in to change notification settings - Fork 2
/
start.py
56 lines (45 loc) · 1.18 KB
/
start.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!.env/bin/python
# -*- coding:utf-8 -*-
# $File: start.py
# $Author: cz <chenze-321n[at]163[dot]com>
from server import get_app, get_db
from flask.ext.bootstrap import Bootstrap
from flask.ext.script import Manager, Shell
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
"""
def wsgi_app():
app=get_app()
import routes
return app
"""
# enable running from shell for debugging
def manager_main():
global app, db, User
app = get_app()
app.config['host'] = '0.0.0.0'
manager = Manager(app)
from flask.ext.migrate import Migrate, MigrateCommand
bootstrap = Bootstrap(app)
db = get_db()
import routes
import api
def make_shell_context():
return dict(app=app, db=db, User=User)
manager.add_command("shell", Shell(make_context=make_shell_context))
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
manager.run()
def main():
app = get_app()
bootstrap = Bootstrap(app)
import routes
import api
# import pdb;pdb.set_trace();
app.run(app.config['HOST'],
app.config['PORT'],
**app.config['OPTIONS'])
if __name__ == '__main__':
manager_main()
# main()