简体   繁体   中英

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 .

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?

Foreman is apparently completely broken on Windows 64 (for years!!), which seems extraordinary that the Heroku team haven't fixed it.

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.

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

But if you pip install gunicorn and add it your Procfile as described in the tutorial, everything should run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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