Bill
Bill

Reputation: 1205

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

Upvotes: 0

Views: 375

Answers (1)

Chris
Chris

Reputation: 136968

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.

Upvotes: 1

Related Questions