我正在尝试将我的django应用程序部署到heroku。我有一个虚拟环境(当然)。我正确设置了procfile,setup.py和runtime.txt。它在本地开发服务器上运行完美,但是当我推送到heroku时,它会在需求文件中出现某种错误。
这是推送到heroku后的第三次追溯。我前两次更改了procfile,然后只给了procfile错误。既然proc文件错误消失了,我就会遇到一些错误。
回溯:
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 309 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Using set buildpack heroku/python
remote: -----> Python app detected
remote: -----> Uninstalling stale dependencies
remote: Invalid requirement: 'There was a problem loading the given requirements files.'
remote: Traceback (most recent call last):
remote: File "/app/.heroku/python/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/req/req_install.py", line 77, in
__init__
remote: req = pkg_resources.Requirement.parse(req)
remote: File "/app/.heroku/python/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/_vendor/pkg_resources/__init__.p
y", line 3036, in parse
remote: req, = parse_requirements(s)
remote: File "/app/.heroku/python/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/_vendor/pkg_resources/__init__.p
y", line 2980, in parse_requirements
remote: "version spec")
remote: File "/app/.heroku/python/lib/python3.5/site-packages/pip-8.1.1-py3.5.egg/pip/_vendor/pkg_resources/__init__.p
y", line 2945, in scan_list
remote: raise RequirementParseError(msg, line, "at", line[p:])
remote: pip._vendor.pkg_resources.RequirementParseError: Expected version spec in There was a problem loading the given
requirements files. at was a problem loading the given requirements files.
remote:
remote: You are using pip version 8.1.1, however version 8.1.2 is available.
remote: You should consider upgrading via the 'pip install --upgrade pip' command.
remote: $ pip install -r requirements.txt
remote:
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web, worker
remote:
remote: -----> Compressing...
remote: Done: 60.3M
remote: -----> Launching...
remote: Released v6
remote: https://calm-caverns-85777.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/calm-caverns-85777.git
b1b06b0..d6b1a95 master -> master
Procfile:
web: gunicorn blog.wsgi
worker: python worker.py
requirements.txt:
dj-database-url==0.4.1
Django==1.9.7
django-crispy-forms==1.6.0
django-markdown-deux==1.0.5
django-pagedown==0.1.1
gunicorn==19.6.0
markdown2==2.3.1
Pillow==3.2.0
whitenoise==3.2
runtime.txt:
python-3.5.1
我可以从requirements.txt文件本地安装dependancies,另一件事是当我尝试更新pip时它说它已经是最新的。我的运行时环境设置为python 3.5.1。应用程序在部署时崩溃,我假设它是由于回溯错误。我该怎么做才能解决这个问题?
答案 0 :(得分:3)
如何创建requirements.txt文件?它是否可能已损坏或不是纯文本或其中包含不可打印的字符?
我建议删除requirements.txt并根据pip冻结干净地生成它。
如果您使用的是Windows Powershell,encoding issue可能会影响您。建议的解决方案是:
resource does not exist