-
Notifications
You must be signed in to change notification settings - Fork 50
/
wsgi.py
executable file
·50 lines (44 loc) · 1.67 KB
/
wsgi.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
# -*- coding: utf-8 -*-
# from flask.ext.script import Manager
from baymax import create_app
from baymax.extensions import db, celery
from baymax.user import User, ADMIN
from baymax.monitor import Monitor
app = create_app()
# manager = Manager(app)
@app.cli.command("run")
def run():
app.run(port=5555, host='0.0.0.0')
@app.cli.command("initdb")
def initdb():
db.drop_all()
db.create_all()
admin = User(name=u'admin', email=u'[email protected]')
db.session.add(admin)
db.session.commit()
@app.cli.command("drop")
def drop():
db.drop_all()
@app.cli.command("insert")
def insert():
# software
m1 = Monitor(name='nike', url='http://dev.nike.com/', introduction='nike plus api')
m2 = Monitor(name='rescuetime', url='https://www.rescuetime.com/developers', introduction='track your internet')
m3 = Monitor(name='fitbit', url='https://dev.fitbit.com/', introduction='fitbit health')
m4 = Monitor(name='withings', url='http://oauth.withings.com/api', introduction='withings health')
m5 = Monitor(name='github', url='https://developer.github.com/', introduction='source code social network')
m6 = Monitor(name='weibo', url='http://open.weibo.com/', introduction='twitter copy to china')
# hardware
m7 = Monitor(name='bong', url='http://www.bong.cn/share/', introduction='bong bracelet')
m8 = Monitor(name='xiaomi', url='https://github.com/stormluke/Mili-iOS', introduction='xiaomi bracelet')
db.session.add(m1)
db.session.add(m2)
db.session.add(m3)
db.session.add(m4)
db.session.add(m5)
db.session.add(m6)
db.session.add(m7)
db.session.add(m8)
db.session.commit()
# if __name__ == "__main__":
# manager.run()