我有一个拼凑的项目,可以抓取数据并保存到mongodb。我想将其部署到Heroku。
我从Scrapy官方网站https://support.scrapinghub.com/support/solutions/articles/22000216178-scrapy-cloud-vs-scrapyd-using-heroku-引用
我添加了requirements.txt:
pymongo==3.5.1
Scrapy==1.4.0
scrapyd==1.0.1
scrapy-heroku==0.7.1
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:
web: scrapyd
在终端上输入git push heroku master
时。
我终于得到了错误:
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'
我认为我已经遵循了官方教程,为什么仍然出现错误?
我应该在某处添加distribute
吗?
我错过了哪一步?任何帮助,将不胜感激。预先感谢。
答案 0 :(得分:1)
这是因为scrapy-heroku不支持python-3,而是使用python-2作为环境。