我正在完成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.任何操作系统相关的问题?
答案 0 :(得分:2)
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
但是如果你按照安装gunicorn并将其添加到教程中所描述的Procfile中,那么一切都应该运行。