繁体   English   中英

Heroku上带有Gunicorn的Bottle应用-工头在本地工作,但不在Heroku上工作

[英]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,看起来还可以
  • 我从其他heroku示例中获得的“ 0.0.0.0” IP仍然应该接受任何IP服务器端,不是吗?
  • Python依赖项似乎安装得很好
  • 我通过工头的.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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM