簡體   English   中英

Heroku在Windows上似乎並不真正支持Python和Django

[英]Heroku does not really seem support Python and Django on Windows

在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

怪罪於Heroku似乎是不公平的。 Gunicorn不支持Windows。 Heroku與Windows無關。

還有其他可能工作的WSGI Web服務器。 例如,uWSGI 具有在Heroku上運行的文檔

快速總結:

  • 確保uwsgiwerkzeug位於您的requirements.txtPipfile / 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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM