当我尝试用Heroku部署Django rest时,我得到了以下内容:
-----> 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使其工作?,我使用了一个虚拟env,在这里我安装了以下内容:
django,
djangorestframework,
django-rest-auth,
django-filter,
django-cors-headers, 我使用python 3.5和django 2.0.1
发布于 2018-10-28 21:57:53
部署Python应用程序的一个常见做法是将Python版本放入runtime.txt文件,而不是runtime.txt文件。
如果您从requirements.txt中删除行python==3.5.0并创建包含python-3.5.0内容的文件runtime.txt,您的应用程序阶段是否正确?
发布于 2018-10-28 21:56:49
看起来您已经将Python放到了requirements.txt文件中。别干那事。
如果您确实需要将Python版本从3.6更改为3.5,则需要将其放在runtime.txt中,而不是requirements.txt中。但真的不应该有任何理由这么做。坚持默认版本。
https://stackoverflow.com/questions/53036410
复制相似问题