2015-12-10 10:56:59 +00:00
|
|
|
#!/usr/bin/env python
|
2015-11-18 17:02:25 +00:00
|
|
|
|
2015-12-10 10:56:59 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
import os
|
|
|
|
|
from flask.ext.script import Manager, Server
|
2016-01-07 17:31:17 +00:00
|
|
|
from flask.ext.migrate import Migrate, MigrateCommand
|
2016-03-03 15:18:12 +00:00
|
|
|
from app import (create_app, db)
|
2015-12-10 10:56:59 +00:00
|
|
|
|
2016-02-16 15:25:46 +00:00
|
|
|
application = create_app()
|
2015-12-10 10:56:59 +00:00
|
|
|
manager = Manager(application)
|
|
|
|
|
port = int(os.environ.get('PORT', 6011))
|
|
|
|
|
manager.add_command("runserver", Server(host='0.0.0.0', port=port))
|
|
|
|
|
|
2016-01-07 17:31:17 +00:00
|
|
|
migrate = Migrate(application, db)
|
|
|
|
|
manager.add_command('db', MigrateCommand)
|
|
|
|
|
|
2015-12-10 10:56:59 +00:00
|
|
|
|
|
|
|
|
@manager.command
|
|
|
|
|
def list_routes():
|
|
|
|
|
"""List URLs of all application routes."""
|
|
|
|
|
for rule in sorted(application.url_map.iter_rules(), key=lambda r: r.rule):
|
|
|
|
|
print("{:10} {}".format(", ".join(rule.methods - set(['OPTIONS', 'HEAD'])), rule.rule))
|
2015-11-18 17:02:25 +00:00
|
|
|
|
2016-01-18 10:56:26 +00:00
|
|
|
|
2015-11-18 17:02:25 +00:00
|
|
|
if __name__ == '__main__':
|
2015-12-10 10:56:59 +00:00
|
|
|
manager.run()
|