首页 > 解决方案 > ModuleNotFoundError:在heroku上运行时,django中没有名为'name_of_project'的模块

问题描述

我第一次尝试在 heroku 上托管我的 django 应用程序,并且我能够成功部署它,但我遇到了一个应用程序错误,正在向我展示我的 heroku 网页的这张图片,当我使用它查看日志时,heroku logs --tail它向我展示了这个错误日志详细信息

在其中显示 ModuleNotFoundError: No module named 'twitter_project' 这里 'twitter_project' 是我的项目的名称。我做了pip install django-heroku并在顶部pip install gunicorn导入并在末尾添加,添加了一个包含此内容的 Procfile,并且也是完整的,并且已经添加了,我不知道我做错了什么。如果我的静态文件有问题,我不会。import django_herokusettings.pydjango_heroku.settings(locals())settings.pyweb: gunicorn twitter_project.wsgirequirements.txtdjango-heroku==0.3.1gunicorn==20.0.4

这是我的项目的结构

C:.
|   as.txt
|   out.doc
|   
+---twitter_project
|   |   db.sqlite3
|   |   manage.py
|   |   Procfile
|   |   requirements.txt
|   |   
|   +---home
|   |   |   admin.py
|   |   |   apps.py
|   |   |   models.py
|   |   |   tests.py
|   |   |   urls.py
|   |   |   views.py
|   |   |   __init__.py
|   |   |   
|   |   +---dash_apps
|   |   |   \---finished_apps
|   |   |       |   simpleexample.py
|   |   |       |   
|   |   |       \---__pycache__
|   |   |               simpleexample.cpython-37.pyc
|   |   |               
|   |   +---migrations
|   |   |   |   __init__.py
|   |   |   |   
|   |   |   \---__pycache__
|   |   |           __init__.cpython-37.pyc
|   |   |           
|   |   +---static
|   |   |   \---home
|   |   |       \---img
|   |   |           |   negative_dettol.png
|   |   |           |   positive_dettol.png
|   |   |           |   
|   |   |           \---bg
|   |   |                   215771.jpg
|   |   |                   q1w2e3.jpg
|   |   |                   qwer.jpg
|   |   |                   qwer1.jpg
|   |   |                   twitter-bird.jpg
|   |   |                   
|   |   +---templates
|   |   |   \---home
|   |   |           home.html
|   |   |           welcome.html
|   |   |           
|   |   \---__pycache__
|   |           admin.cpython-37.pyc
|   |           apps.cpython-37.pyc
|   |           models.cpython-37.pyc
|   |           urls.cpython-37.pyc
|   |           views.cpython-37.pyc
|   |           __init__.cpython-37.pyc
|   |           
|   +---static
|   |   +---admin
|   |   |   +---css
|   |   |   |   |   autocomplete.css
|   |   |   |   |   base.css
|   |   |   |   |   changelists.css
|   |   |   |   |   dashboard.css
|   |   |   |   |   fonts.css
|   |   |   |   |   forms.css
|   |   |   |   |   login.css
|   |   |   |   |   responsive.css
|   |  .
       .
       .
       .
       .
something like this

这是已安装应用程序的片段

标签: pythondjangoheroku

解决方案


推荐阅读