【发布时间】:2018-12-27 17:28:54
【问题描述】:
我有一个烧瓶应用程序设置来在我的代码中使用 gevent WSGIServer。我还在命令行上运行 gunicorn 来启动服务器。
在运行 gunicorn 时,我是否应该在代码中使用 WSGI 服务器?目前看起来像这样:
from flask import Flask
from gevent.pywsgi import WSGIServer
application = Flask(__name__)
@application.route("/")
def hello():
return "hello"
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
WSGIServer(('', port), application).serve_forever()
在命令行上我运行 gunicorn 之类的:
gunicorn -w 4 myapp:application
我的代码中是否需要 WSGIServer,或者只是在默认的烧瓶服务器上将其作为 application.run() 运行?
【问题讨论】: