我正在处理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
但是,如果您 pip install Gunicorn 并将其添加到您的 Procfile(如教程中所述),则一切都应该运行。
关于python - Heroku Python Gunicorn 'Foreman Start' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21380233/