在heroku上部署Django应用程序时出现python模块安装错误

2024-09-29 00:13:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在heroku上部署django应用程序。但是当从requirement.txt文件安装模块时,它会在“Paydunya”模块上返回一个错误。 我正在heroku上部署django应用程序。但是当从requirement.txt文件安装模块时,它会在“Paydunya”模块上返回一个错误

我需要你的帮助来解决这个问题。多谢各位

这是我的requirement.txt文件:

six==1.15.0
dj-database-url==0.5.0
Django==3.2
django-advanced-filters==1.3.0
django-allauth==0.44.0
django-appconf==1.0.4
django-braces==1.14.0
django-compressor==2.4
django-crispy-forms==1.11.2
django-debug-toolbar==3.2
django-filter==2.4.0
django-heroku==0.3.1
django-markdown-deux==1.0.5
django-money==1.3.1
django-pagedown==2.2.0
django-rest-framework==0.1.0
django-tastypie==0.14.3
django-tinymce==3.3.0
django-videofield==0.1.1
django-widget-tweaks==1.4.8
djangorestframework==3.12.4
docutils==0.17
fpdf==1.7.2
future==0.18.2
gunicorn==20.1.0
html5lib==1.1
idna==2.10
joblib==1.0.1
Markdown==3.3.4
markdown2==2.4.0
Pillow==8.2.0
Pygments==2.8.1
PyJWT==2.0.1
pyparsing==2.4.7
PyPDF2==1.26.0
python-decouple==3.4
python-dotenv==0.17.0
requests==2.0.1
requests-mock==1.3.0
requests-oauthlib==1.3.0
rjsmin==1.1.0
simplejson==3.17.2
sqlparse==0.4.1
suit==2.0.2
urllib3==1.26.4
virtualenv==20.4.3
whitenoise==5.2.0
xhtml2pdf==0.2.5
paydunya==1.0.6


以下是Heroku CLI:

C:\Users\aba\Desktop\comsoc-ugb>git push heroku master
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 4 threads
Compressing objects: 100% (15/15), done.
Writing objects: 100% (15/15), 1.33 KiB | 1.33 MiB/s, done.
Total 15 (delta 10), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpack: heroku/python
remote: -----> Python app detected
remote: -----> No Python version was specified. Using the same version as the last build: python-3.9.4
remote:        To use a different version, see: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Requirements file has been changed, clearing cached dependencies
remote: -----> Installing python-3.9.4
remote: -----> Installing pip 20.2.4, setuptools 47.1.1 and wheel 0.36.2
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting six==1.15.0
remote:          Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
remote:        Collecting dj-database-url==0.5.0
remote:          Downloading dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB)
remote:        Collecting Django==3.2
remote:          Downloading Django-3.2-py3-none-any.whl (7.9 MB)
remote:        Collecting django-advanced-filters==1.3.0
remote:          Downloading django_advanced_filters-1.3.0-py3-none-any.whl (68 kB)
remote:        Collecting django-allauth==0.44.0
remote:          Downloading django-allauth-0.44.0.tar.gz (572 kB)
remote:        Collecting django-appconf==1.0.4
remote:          Downloading django_appconf-1.0.4-py2.py3-none-any.whl (6.3 kB)
remote:        Collecting django-braces==1.14.0
remote:          Downloading django_braces-1.14.0-py2.py3-none-any.whl (14 kB)
remote:        Collecting django-compressor==2.4
remote:          Downloading django_compressor-2.4-py2.py3-none-any.whl (126 kB)
remote:        Collecting django-crispy-forms==1.11.2
remote:          Downloading django_crispy_forms-1.11.2-py3-none-any.whl (112 kB)
remote:        Collecting django-debug-toolbar==3.2
remote:          Downloading django_debug_toolbar-3.2-py3-none-any.whl (200 kB)
remote:        Collecting django-filter==2.4.0
remote:          Downloading django_filter-2.4.0-py3-none-any.whl (73 kB)
remote:        Collecting django-heroku==0.3.1
remote:          Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
remote:        Collecting django-markdown-deux==1.0.5
remote:          Downloading django-markdown-deux-1.0.5.zip (16 kB)
remote:        Collecting django-money==1.3.1
remote:          Downloading django_money-1.3.1-py3-none-any.whl (33 kB)
remote:        Collecting django-pagedown==2.2.0
remote:          Downloading django_pagedown-2.2.0-py3-none-any.whl (92 kB)
remote:        Collecting django-rest-framework==0.1.0
remote:          Downloading django-rest-framework-0.1.0.tar.gz (969 bytes)
remote:        Collecting django-tastypie==0.14.3
remote:          Downloading django-tastypie-0.14.3.tar.gz (148 kB)
remote:        Collecting django-tinymce==3.3.0
remote:          Downloading django_tinymce-3.3.0-py3-none-any.whl (935 kB)
remote:        Collecting django-videofield==0.1.1
remote:          Downloading django-videofield-0.1.1.tar.gz (3.9 kB)
remote:        Collecting django-widget-tweaks==1.4.8
remote:          Downloading django_widget_tweaks-1.4.8-py2.py3-none-any.whl (11 kB)
remote:        Collecting djangorestframework==3.12.4
remote:          Downloading djangorestframework-3.12.4-py3-none-any.whl (957 kB)
remote:        Collecting docutils==0.17
remote:          Downloading docutils-0.17-py2.py3-none-any.whl (575 kB)
remote:        Collecting fpdf==1.7.2
remote:          Downloading fpdf-1.7.2.tar.gz (39 kB)
remote:        Collecting future==0.18.2
remote:          Downloading future-0.18.2.tar.gz (829 kB)
remote:        Collecting gunicorn==20.1.0
remote:          Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
remote:        Collecting html5lib==1.1
remote:          Downloading html5lib-1.1-py2.py3-none-any.whl (112 kB)
remote:        Collecting idna==2.10
remote:          Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
remote:        Collecting joblib==1.0.1
remote:          Downloading joblib-1.0.1-py3-none-any.whl (303 kB)
remote:        Collecting Markdown==3.3.4
remote:          Downloading Markdown-3.3.4-py3-none-any.whl (97 kB)
remote:        Collecting markdown2==2.4.0
remote:          Downloading markdown2-2.4.0-py2.py3-none-any.whl (34 kB)
remote:        Collecting Pillow==8.2.0
remote:          Downloading Pillow-8.2.0-cp39-cp39-manylinux1_x86_64.whl (3.0 MB)
remote:        Collecting Pygments==2.8.1
remote:          Downloading Pygments-2.8.1-py3-none-any.whl (983 kB)
remote:        Collecting PyJWT==2.0.1
remote:          Downloading PyJWT-2.0.1-py3-none-any.whl (15 kB)
remote:        Collecting pyparsing==2.4.7
remote:          Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
remote:        Collecting PyPDF2==1.26.0
remote:          Downloading PyPDF2-1.26.0.tar.gz (77 kB)
remote:        Collecting python-decouple==3.4
remote:          Downloading python_decouple-3.4-py3-none-any.whl (9.5 kB)
remote:        Collecting python-dotenv==0.17.0
remote:          Downloading python_dotenv-0.17.0-py2.py3-none-any.whl (18 kB)
remote:        Collecting requests==2.0.1
remote:          Downloading requests-2.0.1-py2.py3-none-any.whl (439 kB)
remote:        Collecting requests-mock==1.3.0
remote:          Downloading requests_mock-1.3.0-py2.py3-none-any.whl (33 kB)
remote:        Collecting requests-oauthlib==1.3.0
remote:          Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
remote:        Collecting rjsmin==1.1.0
remote:          Downloading rjsmin-1.1.0.tar.gz (412 kB)
remote:        Collecting simplejson==3.17.2
remote:          Downloading simplejson-3.17.2.tar.gz (83 kB)
remote:        Collecting sqlparse==0.4.1
remote:          Downloading sqlparse-0.4.1-py3-none-any.whl (42 kB)
remote:        Collecting suit==2.0.2
remote:          Downloading suit-2.0.2.zip (8.7 kB)
remote:        Collecting urllib3==1.26.4
remote:          Downloading urllib3-1.26.4-py2.py3-none-any.whl (153 kB)
remote:        Collecting virtualenv==20.4.3
remote:          Downloading virtualenv-20.4.3-py2.py3-none-any.whl (7.2 MB)
remote:        Collecting whitenoise==5.2.0
remote:          Downloading whitenoise-5.2.0-py2.py3-none-any.whl (19 kB)
remote:        Collecting xhtml2pdf==0.2.5
remote:          Downloading xhtml2pdf-0.2.5.tar.gz (100 kB)
remote:        Collecting paydunya==1.0.6
remote:          Downloading paydunya-1.0.6.tar.gz (147 kB)
remote:            ERROR: Command errored out with exit status 1:
remote:             command: /app/.heroku/python/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xfdyt7z_/paydunya/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xfdyt7z_/paydunya/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-v0w934m8
remote:                 cwd: /tmp/pip-install-xfdyt7z_/paydunya/
remote:            Complete output (7 lines):
remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-install-xfdyt7z_/paydunya/setup.py", line 70, in <module>
remote:                version=__import__('paydunya').__version__,
remote:              File "/tmp/pip-install-xfdyt7z_/paydunya/paydunya/__init__.py", line 11, in <module>
remote:                import requests
remote:            ModuleNotFoundError: No module named 'requests'
remote:            ----------------------------------------
remote:        ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to comsoc-ugb.
remote:
To https://git.heroku.com/comsoc-ugb.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/comsoc-ugb.git'

Tags: djangononeherokukbremotepy3anytar
1条回答
网友
1楼 · 发布于 2024-09-29 00:13:52

您还需要安装“请求”模块。从您收到的错误中可以明显看出:“ModuleNotFoundError:没有名为'requests'的模块”

Python 2

pip install requests

Python 3

pip3 install requests

相关问题 更多 >