-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage.py
More file actions
41 lines (29 loc) · 725 Bytes
/
manage.py
File metadata and controls
41 lines (29 loc) · 725 Bytes
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
from flask import current_app
import os
from flask.ext.script import Manager, Server
port = 5000
if 'PORT' in os.environ:
port = os.environ['PORT']
def create_app():
from application import Application
return Application()
manager = Manager(create_app)
manager.add_command("runserver", Server(port=port))
@manager.shell
def make_shell_context():
from db import db
context = {}
context['app'] = current_app
context['db'] = db
context.update(db.Model._decl_class_registry)
return context
@manager.command
def dropdb():
from db import db
db.drop_all()
@manager.command
def createdb():
from db import db
db.create_all()
if __name__ == "__main__":
manager.run()