[英]Bottle app on heroku with gunicorn - foreman works locally but not on heroku
I've been stuck trying to get my simple bottle
app starting when deployed on heroku. 当部署在heroku上时,我一直想尝试启动我的简单bottle
应用程序。
After quite some searching and tinkering I've got a setup that works locally, but not on heroku. 经过一番搜索和修改后,我得到了一个在本地运行的设置,但不适用于heroku。
In /app.py
: 在/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()
Then in /Procfile
: 然后在/Procfile
:
web: gunicorn app:app --bind="0.0.0.0:$PORT" --debug
Correct me if I misunderstand how gunicorn works, I understand the "app:app" portion as look in the module (=file) called app.py and use whatever is in variable "app" as your WSIG, yes? 如果我误解了gunicorn的工作原理,请纠正我,我理解名为app.py的模块(= file)中的“ app:app”部分,并使用变量“ app”中的内容作为您的WSIG,是吗?
$ heroku run bash
if $PORT is set, seems ok 我已经通过$ heroku run bash
检查了是否设置了$ PORT,看起来还可以 $POST
variable via an .env
file for foreman, everything seems working ok on my setup 我通过工头的.env
文件设置$POST
变量在本地运行,在我的设置中一切正常 $ heroku ps
基于这个问题,我检查了$ 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
shows: $ 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
Not sure really how I could get better debugging results either. 真的不知道如何获得更好的调试结果。 Somehow the Procfile
web process just doesn't seem to work / start, but how can I get info on what's breaking? Procfile
Web流程似乎无法正常工作/无法启动,但是如何获取最新信息?
Anybody got ideas what's going on here? 有人知道这里发生了什么吗?
PS: I'm rather new to heroku, python, bottle & gunicorn :O PS:我对Heroku,Python,瓶子和Gunicorn比较陌生:O
您可以尝试在web: gunicorn app:app
中仅使用web: gunicorn app:app
吗?
What version of gunicorn do you use? 您使用什么版本的Gunicorn? gunicorn 19.1 doesn't write errorlog by default. gunicorn 19.1默认情况下不会写入错误日志。 Try gunicorn --log-file=-
. 试试gunicorn --log-file=-
。
-R
is also useful option to investigate error. -R
也是调查错误的有用选项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.