我最近在 Heroku 上启动了一个应用程序git push heroku master
,并遇到了一些错误:
remote: raise ValueError("Missing distribution spec", line)
remote: ValueError: ('Missing distribution spec', '+ Python (2.7)')
然而,我随后得到了
remote: -----> Compressing... done, 36.5MB
remote: -----> Launching... done, v5
表明应用程序已启动成功。
不幸的是,如果我尝试访问托管该应用程序的页面,我会收到一条包含以下消息的页面:
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
我检查了日志,发现有一个错误,代码为 H14 - 应用程序没有与之关联的测功机。我自然而然地想添加一个测功机,但 Heroku 根本不让我添加。根本没有“编辑”选项。我检查了这个问题发现它与我的情况不太相似,因为据我所知,Heroku 允许我启动该应用程序,因此我认为上述错误并不严重。我错过了什么?
请参阅下文以了解完整git push
输出。
Counting objects: 197, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (193/193), done.
Writing objects: 100% (197/197), 1.95 MiB | 390.00 KiB/s, done.
Total 197 (delta 14), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Stack changed, re-installing runtime
remote: -----> Installing runtime (python-2.7.9)
remote: -----> Installing dependencies with pip
remote: Exception:
remote: Traceback (most recent call last):
remote: File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
remote: status = self.run(options, args)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 262, in run
remote: for req in parse_requirements(filename, finder=finder, options=options, session=session):
remote: File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1631, in parse_requirements
remote: req = InstallRequirement.from_line(line, comes_from, prereleases=getattr(options, "pre", None))
remote: File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 172, in from_line
remote: return cls(req, comes_from, url=url, prereleases=prereleases
remote: File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 70, in __init__
remote: req = pkg_resources.Requirement.parse(req)
remote: 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
remote: reqs = list(parse_requirements(s))
remote: File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/_vendor/pkg_resources.py", line 2593, in parse_requirements
remote: raise ValueError("Missing distribution spec", line)
remote: ValueError: ('Missing distribution spec', '+ Python (2.7)')
remote:
remote: Storing debug log for failure in /app/.pip/pip.log
remote:
remote: -----> Preparing static assets
remote: Collectstatic configuration error. To debug, run:
remote: $ heroku run python ./manage.py collectstatic --noinput
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote:
remote: -----> Compressing... done, 36.5MB
remote: -----> Launching... done, v5
remote: https://firsttest.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/firsttest.git
答案1
requirements.txt
您的: 行中有语法错误
+ Python (2.7)
是无效的。如果这是一条注释,它应该以 开头#
。