繁体   English   中英

ModuleNotFoundError:Heroku中没有名为“ django”的模块

[英]ModuleNotFoundError: No module named 'django' in Heroku

我试图在Heroku中部署我的App,并且出现此错误:

 2018-05-03T14:35:40.682441+00:00 heroku[web.1]: Starting process with command `python manage.py runserver`
2018-05-03T14:35:41.960741+00:00 app[web.1]: Traceback (most recent call last):
2018-05-03T14:35:41.960765+00:00 app[web.1]:   File "manage.py", line 8, in <module>
2018-05-03T14:35:41.960858+00:00 app[web.1]:     from django.core.management import execute_from_command_line
2018-05-03T14:35:41.960872+00:00 app[web.1]: ModuleNotFoundError: No module named 'django'
2018-05-03T14:35:41.960873+00:00 app[web.1]:
2018-05-03T14:35:41.960875+00:00 app[web.1]: The above exception was the direct cause of the following exception:
2018-05-03T14:35:41.960876+00:00 app[web.1]:
2018-05-03T14:35:41.960879+00:00 app[web.1]: Traceback (most recent call last):
2018-05-03T14:35:41.960895+00:00 app[web.1]:   File "manage.py", line 14, in <module>
2018-05-03T14:35:41.961003+00:00 app[web.1]:     ) from exc
2018-05-03T14:35:41.961016+00:00 app[web.1]: ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
2018-05-03T14:35:42.013265+00:00 heroku[web.1]: State changed from starting to crashed
2018-05-03T14:35:42.008966+00:00 heroku[web.1]: Process exited with status 1

我的requirements.txt:

dj-database-url==0.5.0
django-heroku==0.3.1
gunicorn==19.8.1
numpy==1.14.2
psycopg2==2.7.4
python-decouple==3.1
pytz==2018.4
scipy==1.0.1
whitenoise==3.3.1

我的runtime.txt

python-3.6.5

我的Procfile(在“ myapphere”中是我的应用名称)

web: gunicorn myapphere.wsgi
web: python manage.py runserver

问题是我制作了“ git push heroku master”,并且出现错误,我不知道会发生...

部署日志:

Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (13/13), 1.11 KiB | 0 bytes/s, done.
Total 13 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 11.8.2…
remote:        Installing dependencies from Pipfile…
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 53.5M
remote: -----> Launching...
remote:        Released v21
remote:        https://sbceval.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/sbceval.git
   df538a8..a82ea89  master -> master

根据您的日志,您同时拥有Pipfilerequirements.txt 删除其中之一,就可以了

在Heroku接受之前,我必须运行“ pipenv lock”命令,然后删除pipenv文件。 当这类事情发生时,他们是如此挑剔和无助!!!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM