【问题标题】:Heroku Python Gunicorn 'Foreman Start' errorHeroku Python Gunicorn“工头开始”错误
【发布时间】:2014-02-18 06:06:36
【问题描述】:

我正在学习Getting Started with Python on Heroku 教程,我一直到Declare process types with Procfile

但在运行“工头启动”后,它会说:

C:\Users\preatik\helloflask>foreman start
17:09:08 web.1  | started with pid 292
17:09:08 web.1  | Traceback (most recent call last):
17:09:08 web.1  |   File "C:\Python33\lib\runpy.py", line 160, in _run_module_as_main
17:09:09 web.1  |     "__main__", fname, loader, pkg_name)
17:09:09 web.1  |   File "C:\Python33\lib\runpy.py", line 73, in _run_code
17:09:09 web.1  |     exec(code, run_globals)
17:09:09 web.1  | exited with code 1
17:09:09 system | sending SIGKILL to all processes
17:09:09        |   File "C:\Python33\Scripts\gunicorn.exe\__main__.py", line 5, in <module

我也跑了以下:

C:\Users\preatik\helloflask>foreman check
valid procfile detected (web)

任何想法有什么问题吗?我正在使用 Windows 7。任何与操作系统相关的问题?

【问题讨论】:

  • Procfile 应该是这样的: web: gunicorn runp-heroku:app 尝试重新启动...另外,工头显然遇到了 windows 问题:discussion.heroku.com/t/…
  • 感谢您的评论。尝试更改 procfile。没有帮助。

标签: python ruby-on-rails heroku gunicorn foreman


【解决方案1】:

Foreman 在 Windows 64 上显然完全崩溃了(多年来!!),这似乎是 Heroku 团队没有修复它的非凡之处。

但是,回答您的问题。你应该可以跟随Heroku quick start guide,调整你的 hello.py 文件,使其看起来像这样。

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return '<h1>Hello Iain!</h1>'

if __name__ == '__main__':
    app.run(debug=True)

这将允许您从命令行运行您的应用程序,例如:

python hello.py

但是,如果您按照教程中的说明 pip install gunicorn 并将其添加到您的 Procfile 中,那么一切都应该运行。

【讨论】:

    猜你喜欢
    • 2012-09-19
    • 1970-01-01
    • 2014-12-02
    • 2014-08-05
    • 2020-05-12
    • 2013-10-21
    • 2021-06-24
    • 1970-01-01
    相关资源
    最近更新 更多