[英]Flask App with Gunicorn Dockerized, Listening at: http://0.0.0.0:8000, but URL not responding
[英]Started Flask app using gunicorn + gevent, Listening at: http://127.0.0.1:8000, but no response
我使用 gunicorn 和 gevent 使用此命令在本地启动我的烧瓶应用程序 -
gunicorn api:app -k gevent --worker-connections 1000
它说 -
[2020-09-24 11:06:32 +0000] [6] [INFO] Starting gunicorn 20.0.4
[2020-09-24 11:06:32 +0000] [6] [INFO] Listening at: http://127.0.0.1:8000 (6)
[2020-09-24 11:06:32 +0000] [6] [INFO] Using worker: gevent
[2020-09-24 11:06:32 +0000] [8] [INFO] Booting worker with pid: 8
但是当我尝试在此 URL 上触发 API 或打开此 URL 时,它没有得到任何响应。
您需要在代码中设置路由:
https://flask.palletsprojects.com/en/1.1.x/quickstart/
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.