-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanage.py
28 lines (22 loc) · 898 Bytes
/
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
#!/usr/bin/env python
import os
import flask_app
from flask_app import app
from flask_app.app import create_app, db
from flask_app.app.models import User, Book, Read, Keyword, Book_keyword
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand
import flask.ext.whooshalchemy
#from flask_alembic.cli.script import manager as alembic_manager
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
application = create_app(os.getenv('FLASK_CONFIG') or 'default')
def make_shell_context():
return dict(app=app, db=db, User=User, Book=Book, Read=Read,
Keyword=Keyword, Book_Keyword=Book_keyword)
manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)
#manager.add_command('db', alembic_manager)
if __name__ == '__main__':
manager.run()