2015-11-23 13:50:37 +00:00
|
|
|
import os
|
|
|
|
|
from flask.ext import assets
|
2015-11-23 16:07:19 +00:00
|
|
|
from flask.ext.script import Manager, Server
|
2015-11-25 15:29:12 +00:00
|
|
|
from flask_migrate import Migrate, MigrateCommand
|
2015-11-23 13:50:37 +00:00
|
|
|
from webassets.filter import get_filter
|
2015-11-25 15:29:12 +00:00
|
|
|
from app import create_app, db
|
2015-11-23 13:50:37 +00:00
|
|
|
|
|
|
|
|
|
2015-11-24 09:40:14 +00:00
|
|
|
application = create_app(os.getenv('NOTIFICATIONS_ADMIN_ENVIRONMENT') or 'development')
|
2015-11-23 16:07:19 +00:00
|
|
|
manager = Manager(application)
|
|
|
|
|
port = int(os.environ.get('PORT', 6012))
|
|
|
|
|
manager.add_command("runserver", Server(host='0.0.0.0', port=port))
|
2015-11-25 15:29:12 +00:00
|
|
|
migrate = Migrate(application, db)
|
|
|
|
|
manager.add_command('db', MigrateCommand)
|
2015-11-23 13:50:37 +00:00
|
|
|
|
|
|
|
|
|
2015-11-23 16:07:19 +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-23 13:50:37 +00:00
|
|
|
|
|
|
|
|
|
2015-11-23 14:55:37 +00:00
|
|
|
if __name__ == '__main__':
|
2015-11-23 16:07:19 +00:00
|
|
|
manager.run()
|