首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用heroku部署django api

无法使用heroku部署django api
EN

Stack Overflow用户
提问于 2018-10-28 21:50:49
回答 2查看 315关注 0票数 1

当我尝试用Heroku部署Django rest时,我得到了以下内容:

代码语言:javascript
复制
-----> 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,在这里我安装了以下内容:

代码语言:javascript
复制
django, 
djangorestframework, 
django-rest-auth, 
django-filter, 
django-cors-headers, 

我使用python 3.5和django 2.0.1

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-10-28 21:57:53

部署Python应用程序的一个常见做法是将Python版本放入runtime.txt文件,而不是runtime.txt文件。

如果您从requirements.txt中删除行python==3.5.0并创建包含python-3.5.0内容的文件runtime.txt,您的应用程序阶段是否正确?

票数 3
EN

Stack Overflow用户

发布于 2018-10-28 21:56:49

看起来您已经将Python放到了requirements.txt文件中。别干那事。

如果您确实需要将Python版本从3.6更改为3.5,则需要将其放在runtime.txt中,而不是requirements.txt中。但真的不应该有任何理由这么做。坚持默认版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53036410

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档