Пример #1
0
"""Manager module via Flask-Script.

To run: python manage.py [<command>, shell, runserver]
"""

from flask_script import Manager

from zoo import webapp
from zoo.core import db


manager = Manager(webapp.create_app())


@manager.command
def hello():
    print('Hello.')


@manager.command
def create_db():
    """Creates all defined ORM tables."""
    db.create_all()


@manager.command
def seed():
    """Seeds the database."""
    pass

if __name__ == '__main__':
Пример #2
0
"""Main WSGI module.

To run:
   python runserver.py
-or-
   gunicorn runserver:app -b 0.0.0.0:5000
"""

from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware

from zoo import (webapp, api)

DEBUG = True

www_app = webapp.create_app(debug=DEBUG)
api_app = api.create_app(debug=DEBUG)

# Combine multiple applications.
app = DispatcherMiddleware(www_app, {
    '/api/v0': api_app
})

if __name__ == '__main__':
    run_simple('0.0.0.0', 5000, app,
               use_reloader=True, use_debugger=DEBUG)