2

フラスコアプリ用にSocketIOServerを実行していて、次のようなrun.pyスクリプトがあります。

import sys
from idateproto import create_app, run_app

if __name__ == "__main__":
    if len(sys.argv) > 1:
        create_app(sys.argv[1])
    else:
        create_app('dev')
    run_app()

run_appは次のようになります。

def run_app():
    # Run the application
    # See flask/app.py run() for the implementation of run().
    # See http://werkzeug.pocoo.org/docs/serving/ for the parameters of Werkzeug's run_simple()
    # If the debug parameter is not set, Flask does not change app.debug, which is set from
    # the DEBUG app config variable, which we've set in create_app().
    #app.run(**app_run_args)
    global app
    global middleware
    SocketIOServer((app.config['HOST'], app.conf`enter code here`ig['PORT']), middleware,namespace="socket.io", policy_server=False).serve_forever()

私はこれを次のように実行します:python run.py product / dev/testなど。

今度はgunicornを使用して本番環境で実行したいと思います。オンラインのすべてのチュートリアルでは、次のようにすることを提案しています。gunicorn run:app -c gunicorn-config.py私の問題は、アプリだけを実行したくないということです。代わりに、SocketIOServerでserve_foreverメソッドを実行するようにgunicornに指示したいのですが、オンラインで多くの調査を行ったので、これを実現する方法を見つけることができません。助けてください。

4

0 に答える 0