小编Ste*_*ven的帖子

Flask提出与Gunicorn一起运行的"已经在使用的地址"

我正试图用Gunicorn运行我的应用程序.然而,OSError: [Errno 98] Address already in use当Gunicorn开始时,Flask加注,然后Gunicorn关闭.如何使用Gunicorn为应用程序提供服务?

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return 'Hello, World!'

app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)
gunicorn app:app
Run Code Online (Sandbox Code Playgroud)
[2017-02-19 21:09:50 -0800] [21965] [INFO] Starting gunicorn 19.6.0
[2017-02-19 21:09:50 -0800] [21965] [INFO] Listening at: http://127.0.0.1:8000 (21965)
[2017-02-19 21:09:50 -0800] [21965] [INFO] Using worker: sync
[2017-02-19 21:09:50 -0800] [21968] [INFO] Booting worker with pid: 21968
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
[2017-02-19 21:09:50 -0800] [21969] [ERROR] Exception in worker …
Run Code Online (Sandbox Code Playgroud)

python flask gunicorn

11
推荐指数
1
解决办法
4919
查看次数

标签 统计

flask ×1

gunicorn ×1

python ×1