# coding=UTF-8
"""
    wsgi
    ~~~~

    Run the application.
"""
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from application.models import *

import sys

reload(sys)
sys.setdefaultencoding("utf-8")

from application import frontend, api_v1

api_app = api_v1.create_app()


@api_app.before_first_request
def init_db():
    db.create_all()


application = DispatcherMiddleware(frontend.create_app(), {"/api/v1": api_app})

if __name__ == "__main__":
    run_simple("0.0.0.0", 5000, application, use_reloader=True, use_debugger=True)
 def _create_app(self):
     return create_app(settings)
 def _create_app(self):
     return create_app(settings)
Example #4
0
# encoding: utf-8

# created by @cloverstd
# created at 2016-06-23 13:51

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

from application import frontend, api

application = DispatcherMiddleware(frontend.create_app(), {
    "/api": api.create_app()
})

if __name__ == "__main__":
    run_simple('0.0.0.0', 5000, application, use_reloader=True, use_debugger=True)