[英]Bottle app on heroku with gunicorn - foreman works locally but not on heroku
当部署在heroku上时,我一直想尝试启动我的简单bottle
应用程序。
经过一番搜索和修改后,我得到了一个在本地运行的设置,但不适用于heroku。
在/app.py
:
import bottle
import beaker.middleware
from bottle import route, redirect, post, run, request, hook, template, static_file, default_app
bottle.debug(True)
app = beaker.middleware.SessionMiddleware(bottle.app(), session_opts)
...
# app routes etc, no run()
然后在/Procfile
:
web: gunicorn app:app --bind="0.0.0.0:$PORT" --debug
如果我误解了gunicorn的工作原理,请纠正我,我理解名为app.py的模块(= file)中的“ app:app”部分,并使用变量“ app”中的内容作为您的WSIG,是吗?
$ heroku run bash
检查了是否设置了$ PORT,看起来还可以 .env
文件设置$POST
变量在本地运行,在我的设置中一切正常 $ heroku ps
=== web (1X): `gunicorn app:app --bind="0.0.0.0:$PORT" --debug` web.1: crashed 2014/12/24 22:43:00 (~ 1m ago)*)
$ heroku logs
显示: 2014-12-24T20:42:59.235657+00:00 heroku[web.1]: Starting process with command `gunicorn app:app --bind="0.0.0.0:23177" --debug` 2014-12-24T20:43:00.434570+00:00 heroku[web.1]: State changed from starting to up 2014-12-24T20:43:01.813679+00:00 heroku[web.1]: State changed from up to crashed 2014-12-24T20:43:01.803122+00:00 heroku[web.1]: Process exited with status 3
真的不知道如何获得更好的调试结果。 Procfile
Web流程似乎无法正常工作/无法启动,但是如何获取最新信息?
有人知道这里发生了什么吗?
PS:我对Heroku,Python,瓶子和Gunicorn比较陌生:O
您可以尝试在web: gunicorn app:app
中仅使用web: gunicorn app:app
吗?
您使用什么版本的Gunicorn? gunicorn 19.1默认情况下不会写入错误日志。 试试gunicorn --log-file=-
。
-R
也是调查错误的有用选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.