无法使用heroku部署django api
当我尝试用Heroku部署我的Django rest API时,我得到以下结果:无法使用heroku部署django api,django,heroku,Django,Heroku,当我尝试用Heroku部署我的Django rest API时,我得到以下结果: -----> Python app detected Using supported version of Python 3.6 (python-3.6.6) -----> Installing python-3.6.6 -----> Installing pip -----> Installing SQLite3 -----> Installing requiremen
-----> Python app detected
Using supported version of Python 3.6 (python-3.6.6)
-----> Installing python-3.6.6
-----> Installing pip
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting Python==3.5.1 (from -r /tmp/build_eff222df1413c9c747fe9d073117baf7/requirements.txt (line 1))
Could not find a version that satisfies the requirement Python==3.5.1 (from -r /tmp/build_eff222df1413c9c747fe9d073117baf7/requirements.txt (line 1)) (from versions: )
No matching distribution found for Python==3.5.1 (from -r /tmp/build_eff222df1413c9c747fe9d073117baf7/requirements.txt (line 1))
! Push rejected, failed to compile Python app.
! Push failed
如何设置我的requirements.txt使其工作?我使用了一个虚拟环境,在那里我安装了以下内容:
django,
djangorestframework,
django-rest-auth,
django-filter,
django-cors-headers,
我使用的是python 3.5和django 2.0.1,看起来您已经将python放在requirements.txt文件中了。不要那样做
如果确实需要将Python版本从3.6更改为3.5,则需要将其放在runtime.txt中,而不是requirements.txt中。但真的不应该有任何理由这么做。坚持使用默认版本。部署Python应用程序的常见做法是将Python版本放入runtime.txt文件,而不是requirements.txt
如果从requirements.txt中删除行
python==3.5.0
,并创建一个包含python-3.5.0内容的文件runtime.txt,你的应用程序是否正常运行?问题是这样的,我从requirements.txt中删除了python,但错误仍然相同,heroku似乎没有更新更改,你是对的,我只是没有正确地推动变革