示例#1
0
#!/usr/bin/python
"""
see this post
http://www.onurguzel.com/
how-to-run-flask-applications-with-nginx-using-gunicorn/
"""

import argparse
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from werkzeug.contrib.fixers import ProxyFix
from quokka import create_app, create_api
from quokka.utils.paas import activate

# If running on PAAS such as OpenShift or heroku may require venv activation
activate()

application = DispatcherMiddleware(create_app(), {'/api': create_api()})

application.wsgi_app = ProxyFix(application.app.wsgi_app)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r',
                        '--reloader',
                        action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d',
                        '--debug',
示例#2
0
#!/usr/bin/python
"""
see this post
http://www.onurguzel.com/
how-to-run-flask-applications-with-nginx-using-gunicorn/
"""

import argparse
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from werkzeug.contrib.fixers import ProxyFix
from quokka import create_app, create_api
from quokka.utils.paas import activate

# If running on PAAS such as OpenShift or heroku may require venv activation
activate()

application = DispatcherMiddleware(create_app(), {
    '/api': create_api()
})

application.wsgi_app = ProxyFix(application.app.wsgi_app)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r', '--reloader', action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d', '--debug', action='store_true',
                        help='Turn debug on')
示例#3
0
文件: wsgi.py 项目: Cetids/quokka
#!/usr/bin/python

import argparse
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from quokka import create_app, create_api
from quokka.utils.paas import activate

application = DispatcherMiddleware(create_app(), {
    '/api': create_api()
})

application = app = activate(application)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r', '--reloader', action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d', '--debug', action='store_true',
                        help='Turn debug on')
    args = parser.parse_args()
    run_simple(
        args.host or '0.0.0.0',
        int(args.port) if args.port else 5000,
        application,
        use_reloader=args.reloader or False,
        use_debugger=args.debug or False,
    )
示例#4
0
#!/usr/bin/python

import argparse
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from quokka import create_app, create_api
from quokka.utils.paas import activate

application = DispatcherMiddleware(create_app(), {'/api': create_api()})

application = app = activate(application)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r',
                        '--reloader',
                        action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d',
                        '--debug',
                        action='store_true',
                        help='Turn debug on')
    args = parser.parse_args()
    run_simple(
        args.host or '0.0.0.0',
        int(args.port) if args.port else 5000,
        application,
        use_reloader=args.reloader or False,
        use_debugger=args.debug or False,