在Python / Django应用程序上,Heroku似乎对Gunicorn有依赖性。 Windows不支持Gunicorn。有没有人成功或知道解决方法?
我的应用运行正常,但在Heroku或Heroku本地环境下运行不正常
错误:
...site-packages\gunicorn\util.py", line 9, in <module>
import fcntl
ModuleNotFoundError: No module named 'fcntl'
Exited with exit code null
答案 0 :(得分:0)
为此怪罪Heroku似乎是不公平的。 Gunicorn 不支持Windows。 Heroku与Windows无关。
还有其他可能工作的WSGI Web服务器。例如,uWSGI has documentation for running on Heroku。
快速摘要:
确保uwsgi
和werkzeug
在您的requirements.txt
或Pipfile
/ Pipfile.lock
中,并且Git跟踪了这些文件
创建并跟踪包含以下内容的uwsgi.ini
文件
[uwsgi]
http-socket = :$(PORT)
master = true
processes = 4
die-on-term = true
module = werkzeug.testapp:test_app
memory-report = true
确保为您的应用正确设置module
。
将您的Procfile
更新为包含
web: uwsgi uwsgi.ini
确保它可以与heroku local
一起使用,然后推送到Heroku。