Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 部署到heroku需求的Django错误_Python_Django_Heroku - Fatal编程技术网

Python 部署到heroku需求的Django错误

Python 部署到heroku需求的Django错误,python,django,heroku,Python,Django,Heroku,我正在尝试将我的a django应用程序部署到heroku。我有一个虚拟环境(当然)。我已经正确设置了procfile、setup.py和runtime.txt。它在本地开发服务器上运行得很好,但当我推到heroku时,它会在需求文件中出现某种错误 这是推到heroku后的第三次追踪。我前两次更改了procfile,然后它只给出了procfile的错误。现在procfile错误消失了,我有一些错误 回溯: Counting objects: 3, done. Delta compress

我正在尝试将我的a django应用程序部署到heroku。我有一个虚拟环境(当然)。我已经正确设置了procfile、setup.py和runtime.txt。它在本地开发服务器上运行得很好,但当我推到heroku时,它会在需求文件中出现某种错误

这是推到heroku后的第三次追踪。我前两次更改了procfile,然后它只给出了procfile的错误。现在procfile错误消失了,我有一些错误

回溯:

    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
程序文件:

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文件本地安装依赖项,另一件事是当我尝试更新pip时,它说它已经是最新的。我的运行时环境设置为python 3.5.1。应用程序在部署时崩溃,我认为这是因为回溯错误。如何解决此问题?

requirements.txt文件是如何创建的?它是否可能已损坏或不是纯文本,或其中包含不可打印的字符

我建议删除requirements.txt并基于pip freeze干净地生成它

如果您使用的是Windows Powershell,则可能会影响您。建议的解决办法是:

pip freeze | Out-File -Encoding ASCII requirements.txt

requirements.txt文件是如何创建的?它是否可能已损坏或不是纯文本,或其中包含不可打印的字符

我建议删除requirements.txt并基于pip freeze干净地生成它

如果您使用的是Windows Powershell,则可能会影响您。建议的解决办法是:

pip freeze | Out-File -Encoding ASCII requirements.txt

如果你再次部署,同样的事情会发生吗?是的,它会再次发生。愚蠢的问题:
requirements.txt
在源代码管理下吗?是的@Two-bitalchemistry你能
heroku运行bash
只是为了检查它是否存在,而不是损坏,等等?如果你再次部署,同样的事情会发生吗?是的,它会再次发生。愚蠢的问题:
requirements.txt
在源代码管理下?是的@Two-bitalchemistry你能
heroku运行bash
只是为了检查它在那里,没有损坏,等等吗?谢谢!这起作用了,不幸的是我不能投赞成票,希望其他人投!谢谢这起作用了,不幸的是我不能投赞成票,希望其他人投!