-
Notifications
You must be signed in to change notification settings - Fork 37
/
manage.py
executable file
·42 lines (31 loc) · 1.12 KB
/
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
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python2.7
import os, sys
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
name, value = line.strip().split('=', 1)
os.environ[name] = value
from sirius.web import webapp
from sirius.fake import commands as fake_commands
from sirius.emulate import commands as emulate_commands
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
app = webapp.create_app(os.getenv('FLASK_CONFIG', 'default'))
manager = Manager(app)
migrate = Migrate(app, webapp.db)
def make_shell_context():
return dict(app=app, db=webapp.db)
manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)
manager.add_command('fake', fake_commands.fake_manager)
manager.add_command('emulate', emulate_commands.manager)
@manager.command
def deploy():
"""Run deployment tasks."""
from flask.ext.migrate import upgrade
# migrate database to latest revision
upgrade()
if __name__ == '__main__':
manager.run()
# run with
#gunicorn -b 0.0.0.0:5000 -k flask_sockets.worker manage:app