我正在尝试按照手册与Dokku部署helloworld Flask应用程序。
要求:
Flask==0.9
Jinja2==2.6
Werkzeug==0.8.3
gunicorn==0.17.2
Procfile:
web: gunicorn wsgi:app -b 127.0.0.1:$PORT
wsgi.py:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
docker container侦听端口49153
wget 127.0.0.1:49153给了我
Connecting to 127.0.0.1:49153... connected.
HTTP request sent, awaiting response... No data received.
Retrying.
docker logs没有错误:
2014-02-01 08:35:03 [10] [INFO] Starting gunicorn 0.17.2
2014-02-01 08:35:03 [10] [INFO] Listening at: http://127.0.0.1:5000 (10)
2014-02-01 08:35:03 [10] [INFO] Using worker: sync
2014-02-01 08:35:03 [15] [INFO] Booting worker with pid: 15
如何调试此错误?
答案 0 :(得分:0)
尝试将dokku更新为稳定版,或者在干净的ubuntu上设置dokku
答案 1 :(得分:0)
您的Procfile有问题。您不应指定Flask仅侦听127.0.0.1。请尝试0.0.0.0。
因此,我建议您可以将Procfile修改为:
web: gunicorn wsgi:app -b 0.0.0.0:$PORT
答案 2 :(得分:0)
不要在Procfile中指定主机和端口,
if
就足够了