Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 52 lines (40 sloc) 1.45 KB
#!/usr/bin/env python
from __future__ import print_function
# import 3rd party libraries
from flask.ext.script import Manager
from flask.ext.assets import ManageAssets
from werkzeug.serving import run_simple, WSGIRequestHandler
# patch builtins to add INTERACT
import __builtin__
from utils.pyutils import interact
__builtin__.INTERACT = interact
# import settings and initialize app object
from config import settings
from import initialize_app
app = initialize_app(settings)
# import libraries
from utils.dbutils import reset_database, DatabaseControlError
# import our code after initialization of app
from config.log import setup_logging
from backend.models import db
manager = Manager(app)
manager.add_command('assets', ManageAssets())
def runserver(port=5000, bindhost=''):
"start the development server"
class SilentWSGIRequestHandler(WSGIRequestHandler):
def log_request(self, *args, **kwargs): pass
run_simple(bindhost, port, app, request_handler=SilentWSGIRequestHandler,
use_reloader=app.debug, use_debugger=app.debug)
def recreatedb():
"destroy the database (if any) and recreate it"
except DatabaseControlError, error:
print("failed resetting database: %s" % (error,))
with app.app_context():
if __name__ == "__main__":