繁体   English   中英

Python 无法推送到 Heroku

[英]Python cannot be push to Heroku

我尝试将 Django 应用程序部署到 Heroku,但推送被拒绝。 结果显示:推送被拒绝,编译Python应用失败。 从错误脚本来看,似乎没有找到模型“ConfigParser”。

我谷歌这个问题,似乎另一个人也有这个问题( https://github.com/hashedin/squealy/issues/229 )。 Python 3.7 真的不能在 Heroku 中工作吗? 我怎么处理呢? 部分详细命令结果脚本如下:

remote:        Collecting views==0.3 (from -r /tmp/build_ed5220ea80c3d6e758ae010                                                                                            6d17c8450/requirements.txt (line 54))
remote:          Downloading https://files.pythonhosted.org/packages/1b/d9/5598d                                                                                            590f9467c364704397cbb0ebc9b33481b84e947c2af31cc1dc9fa11/views-0.3.tar.gz
remote:        Collecting w3lib==1.19.0 (from -r /tmp/build_ed5220ea80c3d6e758ae                                                                                            0106d17c8450/requirements.txt (line 55))
remote:          Downloading https://files.pythonhosted.org/packages/37/94/40c93                                                                                            ad0cadac0f8cb729e1668823c71532fd4a7361b141aec535acb68e3/w3lib-1.19.0-py2.py3-non                                                                                            e-any.whl
remote:        Collecting Werkzeug==0.14.1 (from -r /tmp/build_ed5220ea80c3d6e75                                                                                            8ae0106d17c8450/requirements.txt (line 56))
remote:          Downloading https://files.pythonhosted.org/packages/20/c4/12e3e                                                                                            56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-                                                                                            none-any.whl (322kB)
remote:        Collecting zope.interface==4.5.0 (from -r /tmp/build_ed5220ea80c3                                                                                            d6e758ae0106d17c8450/requirements.txt (line 57))
remote:          Downloading https://files.pythonhosted.org/packages/ac/8a/65753                                                                                            2df378c2cd2a1fe6b12be3b4097521570769d4852ec02c24bd3594e/zope.interface-4.5.0.tar                                                                                            .gz (151kB)
remote:        Collecting psycopg2>=2.6.1 (from -r /tmp/build_ed5220ea80c3d6e758                                                                                            ae0106d17c8450/requirements.txt (line 58))
remote:          Downloading https://files.pythonhosted.org/packages/37/88/40748                                                                                            331bf75d068a07bbea7dc658faceb0ce2e9fffdde550e76d5475e59/psycopg2-2.7.5-cp37-cp37                                                                                            m-manylinux1_x86_64.whl (2.7MB)
remote:        Collecting MySQL-python (from mysql==0.0.1->-r /tmp/build_ed5220e                                                                                            a80c3d6e758ae0106d17c8450/requirements.txt (line 31))
remote:          Downloading https://files.pythonhosted.org/packages/a5/e9/51b54                                                                                            4da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (                                                                                            108kB)
remote:            Complete output from command python setup.py egg_info:
remote:            Traceback (most recent call last):
remote:              File "<string>", line 1, in <module>
remote:              File "/tmp/pip-build-t_7e9for/MySQL-python/setup.py", line                                                                                             13, in <module>
remote:                from setup_posix import get_config
remote:              File "/tmp/pip-build-t_7e9for/MySQL-python/setup_posix.py",                                                                                             line 2, in <module>
remote:                from ConfigParser import SafeConfigParser
remote:            ModuleNotFoundError: No module named 'ConfigParser'
remote:
remote:            ----------------------------------------
remote:        Command "python setup.py egg_info" failed with error code 1 in /t                                                                                            mp/pip-build-t_7e9for/MySQL-python/
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to damp-brook-61138.
remote:
To https://git.heroku.com/damp-brook-61138.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/damp-brook-61138.git'

requirements.txt 是这样的:

asn1crypto==0.24.0
attrs==18.1.0
auth==0.5.3
Automat==0.7.0
beautifulsoup4==4.6.1
blinker==1.4
bs4==0.0.1
certifi==2018.4.16
cffi==1.11.5
chardet==3.0.4
constantly==15.1.0
cryptography==2.3
cssselect==1.0.3
dj-database-url==0.5.0
dj-static==0.0.6
Django==2.1
django-bootstrap3==10.0.1
django-forms-bootstrap==3.1.0
dnspython==1.15.0
eventlet==0.24.1
falcon==1.4.1
greenlet==0.4.14
gunicorn==19.9.0
hyperlink==18.0.0
idna==2.7
incremental==17.5.0
lxml==4.2.4
misaka==2.1.0
mongoengine==0.15.3
monotonic==1.5
mysql==0.0.1
mysql-connector==2.1.6
mysqlclient==1.3.13
parsel==1.5.0
pyasn1==0.4.4
pyasn1-modules==0.2.2
pycparser==2.18
PyDispatcher==2.0.5
PyHamcrest==1.9.0
pymongo==3.7.1
PyMySQL==0.9.2
pyOpenSSL==18.0.0
python-mimeparse==1.6.0
pytz==2018.5
queuelib==1.5.0
requests==2.19.1
Scrapy==1.5.1
service-identity==17.0.0
six==1.11.0
static3==0.7.0
Twisted==18.7.0
typed-ast==1.1.0
urllib3==1.23
views==0.3
w3lib==1.19.0
Werkzeug==0.14.1
zope.interface==4.5.0
psycopg2>=2.6.1

这可能是模块ConfigParser导入时的 python3 导入错误吗?

我希望这有帮助。

这是Abe Karplus 的回答

在 Python 3 中, ConfigParser已重命名为configparser以符合 PEP 8。 您正在安装的软件包似乎不支持 Python 3。

暂无
暂无

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

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