代码之家  ›  专栏  ›  技术社区  ›  Morton

scrapy push to heroku get错误:push被拒绝,未能编译python应用程序

  •  0
  • Morton  · 技术社区  · 7 年前

    我有一个垃圾项目可以抓取数据并保存到MongoDB。我想把它部署到Heroku。

    我从斯皮奇官网上查到了 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
    

    剪贴画.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>
    

    程序文件:

    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 在什么地方?

    我错过了哪一步?任何帮助都将不胜感激。提前谢谢。

    1 回复  |  直到 7 年前
        1
  •  1
  •   Shubham Jain    6 年前

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