Jok*_*ker 6 deployment django heroku
我的问题:
当使用gunicorn作为我的WSGI HTTP服务器时,工头无法找到Django(wsgi?)应用程序.
应用结构:
在我的Django应用程序中,我的结构如下:
<git_repository_root>/
<django_project_root>/
<configuration_root>/
Run Code Online (Sandbox Code Playgroud)
该<git_repository_root>
包含项目管理和部署有关的东西(requirements.txt
,Procfile
,fabfile.py
等)
在<django_project_root>
包含我的Django的应用程序和应用程序逻辑.
最后,<configuration_root>
包含我settings.py
和wsgi.py
.
我尝试过的:
我Procfile
应该看起来像这样(根据Heroku Docs):
web: gunicorn myapp.wsgi
foreman start
使用此项目布局运行时,出现错误:
ImportError: Import by filename is not supported.
Run Code Online (Sandbox Code Playgroud)
什么有效:
如果我将我的Procfile移动<git_repository_root>
到<git_repository_root>
它本地工作.在推送到Heroku之后(注意:Heroku看到<git_repository_root>
)我无法扩展任何工人/添加进程.我得到以下内容:
Scaling web dynos... failed
! No such process type web defined in Procfile.
Run Code Online (Sandbox Code Playgroud)
我相信,我想Procfile
在我<git_repository_root>
反正虽然-那么,为什么不工作?我也尝试过Procfile
改为:
web: gunicorn myapp/myapp.wsgi
但没有运气.任何帮助将非常感激!
Procfile
向后移动<git_repository_root>
并使用:
web: gunicorn <django_project_root>.myapp:myapp
Run Code Online (Sandbox Code Playgroud)
将最后的“myapp”替换为您的应用程序的类名,大概它确实是“myapp”。
...并阅读错误消息:它告诉您无法app
通过文件名(myapp.wsgi)导入工作类(),所以当然说dirname/myapp.wsgi
也不起作用。您需要 Pythonmodule:class
语法。
归档时间: |
|
查看次数: |
1320 次 |
最近记录: |