简体   繁体   English

Scrapy推送到Heroku会出现错误:推送被拒绝,无法编译Python应用

[英]Scrapy push to Heroku get error: Push rejected, failed to compile Python app

I have s scrapy project can crawl data and save to mongodb. 我的scrapy项目可以抓取数据并保存到mongodb。 I want to deploy it to Heroku. 我想将其部署到Heroku。

I take a reference from Scrapy official website https://support.scrapinghub.com/support/solutions/articles/22000216178-scrapy-cloud-vs-scrapyd-using-heroku- 我从Scrapy官方网站https://support.scrapinghub.com/support/solutions/articles/22000216178-scrapy-cloud-vs-scrapyd-using-heroku-

I add requirements.txt: 我添加了requirements.txt:

pymongo==3.5.1
Scrapy==1.4.0
scrapyd==1.0.1
scrapy-heroku==0.7.1

scrapy.cfg: scrapy.cfg:

[settings]
default = MyMovies.settings

[scrapyd]
application = scrapy_heroku.app.application

[deploy]
#url = http://localhost:6800/
url = http://moviescrapy.herokuapp.com:80/
project = MyMovies
username = <My Heroku account>
password = <My Heroku password>

Procfile: Procfile:

web: scrapyd

When type git push heroku master on terminal. 当输入git push heroku master终端。

I get the error finally: 我终于得到了错误:

remote:            AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
remote:            
remote:            ----------------------------------------
remote:        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-oj017as5/distribute/
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to moviescrapy.
remote: 
To https://git.heroku.com/moviescrapy.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/moviescrapy.git'

I think i have follow the official tutorial, why i still get the error ? 我认为我已经遵循了官方教程,为什么仍然会收到错误消息?

Should i add distribute somewhere ? 我应该在某处添加distribute吗?

What step i miss it ? 我错过了哪一步? Any help would be appreciated. 任何帮助,将不胜感激。 Thanks in advance. 提前致谢。

这是因为scrapy-heroku不支持python-3,而是使用python-2作为环境。

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

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