python - Heroku Python Gunicorn 'Foreman Start' 错误

标签 python ruby-on-rails heroku gunicorn foreman

我正在处理Getting Started with Python on Heroku教程,我一直到 Declare process types with Procfile .

但是运行“foreman start”后,它说:

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。有任何操作系统相关问题吗?

最佳答案

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 你好.py

但是,如果您 p​​ip install Gunicorn 并将其添加到您的 Procfile(如教程中所述),则一切都应该运行。

关于python - Heroku Python Gunicorn 'Foreman Start' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21380233/

相关文章:

python - GDB pretty-print ImportError : No module named 'printers'

python - 停止在 nao 机器人上运行的 Python 脚本触摸他的头

python - 相当于 'in' 用于比较两个 Numpy 数组

python - QtWebkit 和 hasPendingEvents() 始终为 True

php - 无法将 Laravel 应用程序部署到 Heroku - symfony/polyfill-ctype v1.24.0 需要 php >=7.1

ruby - 如何每月在 Heroku 运行一次 Scheduler 插件?

ruby-on-rails - <tt> 在 Ruby 注释中代表什么?

ruby-on-rails - rails 将 check_box_tag 条目大写

ruby-on-rails - rails 3 - 使用 SSL 保护应用程序

nginx - 80 端口上的 heroku + nginx