简体   繁体   中英

Heroku does not really seem support Python and Django on Windows

Heroku seems to have a dependency on Gunicorn when it comes to Python / Django apps. Gunicorn is not supported on Windows. Has anybody had success or know of a work around?

My app runs fine but not under Heroku or Heroku local

Error:

...site-packages\gunicorn\util.py", line 9, in <module>
import fcntl
ModuleNotFoundError: No module named 'fcntl'
Exited with exit code null

It seems unfair to blame Heroku for this. Gunicorn doesn't support Windows. Heroku has nothing to do with Windows.

There are other WSGI web servers that may work. For example, uWSGI has documentation for running on Heroku .

A quick summary:

  • Make sure that uwsgi and werkzeug are in your requirements.txt or Pipfile / Pipfile.lock and that these files are tracked by Git

  • Create and track a uwsgi.ini file containing something like

     [uwsgi] http-socket = :$(PORT) master = true processes = 4 die-on-term = true module = werkzeug.testapp:test_app memory-report = true 

    making sure to set the module appropriately for your application.

  • Update your Procfile to contain

     web: uwsgi uwsgi.ini 

Make sure it works with heroku local , then push to Heroku.

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