简体   繁体   English

Heroku Python Gunicorn“工头启动”错误

[英]Heroku Python Gunicorn 'Foreman Start' error

i am working through Getting Started with Python on Heroku tutorial and i got all the way down to Declare process types with Procfile . 我正在通过Heroku教程上的Python入门指南进行工作,我一直使用Procfile声明过程类型

but after running "foreman start", it says: 但是在运行“领班启动”之后,它说:

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

i also ran following : 我还跑了以下:

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

Any ideas what is wrong? 任何想法有什么问题吗? i am using windows 7. any OS related issue? 我正在使用Windows 7.任何与操作系统相关的问题?

Foreman is apparently completely broken on Windows 64 (for years!!), which seems extraordinary that the Heroku team haven't fixed it. 工头显然已经在Windows 64上完全损坏(多年!!),对于Heroku团队尚未修复的问题来说,这似乎非同寻常。

However, to answer your question. 但是,回答您的问题。 You should be able to follow along with Heroku quick start guide , tweak your hello.py file to look like this. 您应该能够按照Heroku快速入门指南进行操作 ,将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)

This will allow you to run your app from the command line, eg: 这将允许您从命令行运行应用程序,例如:

python hello.py python hello.py

But if you pip install gunicorn and add it your Procfile as described in the tutorial, everything should run. 但是,如果您按照教程中的说明安装gunicorn并将其添加到Procfile中,则所有内容都应运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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