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

Dim*_*ães 2 python heroku

我尝试在 Heroku 中部署我的应用程序,并出现此错误:

\n\n
 2018-05-03T14:35:40.682441+00:00 heroku[web.1]: Starting process with command `python manage.py runserver`\n2018-05-03T14:35:41.960741+00:00 app[web.1]: Traceback (most recent call last):\n2018-05-03T14:35:41.960765+00:00 app[web.1]:   File "manage.py", line 8, in <module>\n2018-05-03T14:35:41.960858+00:00 app[web.1]:     from django.core.management import execute_from_command_line\n2018-05-03T14:35:41.960872+00:00 app[web.1]: ModuleNotFoundError: No module named \'django\'\n2018-05-03T14:35:41.960873+00:00 app[web.1]:\n2018-05-03T14:35:41.960875+00:00 app[web.1]: The above exception was the direct cause of the following exception:\n2018-05-03T14:35:41.960876+00:00 app[web.1]:\n2018-05-03T14:35:41.960879+00:00 app[web.1]: Traceback (most recent call last):\n2018-05-03T14:35:41.960895+00:00 app[web.1]:   File "manage.py", line 14, in <module>\n2018-05-03T14:35:41.961003+00:00 app[web.1]:     ) from exc\n2018-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?\n2018-05-03T14:35:42.013265+00:00 heroku[web.1]: State changed from starting to crashed\n2018-05-03T14:35:42.008966+00:00 heroku[web.1]: Process exited with status 1\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的要求.txt:

\n\n
dj-database-url==0.5.0\ndjango-heroku==0.3.1\ngunicorn==19.8.1\nnumpy==1.14.2\npsycopg2==2.7.4\npython-decouple==3.1\npytz==2018.4\nscipy==1.0.1\nwhitenoise==3.3.1\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的运行时间.txt

\n\n
python-3.6.5\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的 Procfile(\'myapphere\' 中是我的应用程序名称)

\n\n
web: gunicorn myapphere.wsgi\nweb: python manage.py runserver\n
Run Code Online (Sandbox Code Playgroud)\n\n

问题是我创建“git push heroku master\”并出现错误,我不知道会发生这种情况......

\n\n

部署日志:

\n\n
Counting objects: 13, done.\nDelta compression using up to 4 threads.\nCompressing objects: 100% (11/11), done.\nWriting objects: 100% (13/13), 1.11 KiB | 0 bytes/s, done.\nTotal 13 (delta 7), reused 0 (delta 0)\nremote: Compressing source files... done.\nremote: Building source:\nremote:\nremote: -----> Python app detected\nremote: -----> Installing pip\nremote: -----> Installing dependencies with Pipenv 11.8.2\xe2\x80\xa6\nremote:        Installing dependencies from Pipfile\xe2\x80\xa6\nremote: -----> Discovering process types\nremote:        Procfile declares types -> web\nremote:\nremote: -----> Compressing...\nremote:        Done: 53.5M\nremote: -----> Launching...\nremote:        Released v21\nremote:        https://sbceval.herokuapp.com/ deployed to Heroku\nremote:\nremote: Verifying deploy... done.\nTo https://git.heroku.com/sbceval.git\n   df538a8..a82ea89  master -> master\n
Run Code Online (Sandbox Code Playgroud)\n

awe*_*oon 6

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