"使用pip"安装依赖项;将flask项目部署到Heroku时出现异常

时间:2014-07-20 03:36:40

标签: python git heroku flask

我试图使用git push heroku master将一个简单的应用程序部署到heroku,然后我收到以下错误:

$git push heroku master  
Initializing repository, done.  
Counting objects: 14, done.  
Delta compression using up to 4 threads.  
Compressing objects: 100% (12/12), done.  
Writing objects: 100% (14/14), 8.85 KiB | 0 bytes/s, done.  
Total 14 (delta 2), reused 0 (delta 0)  

-----> Python app detected  
-----> Installing runtime (python-2.7.8)  
-----> Installing dependencies with pip  
       Exception:  
       Traceback (most recent call last):  
         File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main  
           status = self.run(options, args)  
         File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 262, in run  
           for req in parse_requirements(filename, finder=finder, options=options, session=session):  
         File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1629, in parse_requirements  
           line, comes_from=comes_from, default_vcs=options.default_vcs if options else None)  
         File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 124, in from_editable  
           prereleases=True)  
         File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 70, in __init__  
           req = pkg_resources.Requirement.parse(req)  
         File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/pkg_resources.py", line 2667, in parse  
           reqs = list(parse_requirements(s))  
         File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/pkg_resources.py", line 2605, in parse_requirements  
           line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")  
         File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/pkg_resources.py", line 2573, in scan_list  
           raise ValueError("Expected "+item_name+" in",line,"at",line[p:])  
       ValueError: ('Expected version spec in', 'Flask-origin/HEAD', 'at', '/HEAD')  

       Storing debug log for failure in /app/.pip/pip.log  

 !     Push rejected, failed to compile Python app  

To git@heroku.com:still-brook-1028.git  
 ! [remote rejected] master -> master (pre-receive hook declined)  
error: failed to push some refs to 'git@heroku.com:still-brook-1028.git'

我猜可能会有一些版本不一致,但无法弄清楚它是哪一个。这是我的要求.txt:

-e git+http://github.com/mitsuhiko/flask.git@577581665ce745898c29ca502e0a3aba1f16677e#egg=Flask-origin/HEAD
Jinja2==2.7.3
MarkupSafe==0.18
Werkzeug==0.9.6
click==2.4
gunicorn==19.0.0
itsdangerous==0.24
wsgiref==0.1.2

这是我在这里发表的第一篇文章,如果有什么不好的话,请告诉我。非常感谢〜!

1 个答案:

答案 0 :(得分:1)

-origin/HEAD删除git+http://github.com/mitsuhiko/flask.git@577581665ce745898c29ca502e0a3aba1f16677e#egg=Flask-origin/HEAD部分:

-e git+http://github.com/mitsuhiko/flask.git@577581665ce745898c29ca502e0a3aba1f16677e#egg=Flask
Jinja2==2.7.3
MarkupSafe==0.18
Werkzeug==0.9.6
click==2.4
gunicorn==19.0.0
itsdangerous==0.24
wsgiref==0.1.2

using VCS #egg=之后的文字必须是有效的requirement specifier时,格式与直接指定套餐时的格式相同:

  

网址后缀“egg =< project name>” pip使用它的依赖逻辑来在pip下载和分析元数据之前识别项目。