首页 > 解决方案 > 使用 python 3.8 将 Django 部署到 heroku

问题描述

我正在尝试将我的 django 应用程序部署到 Heroku。

但是当我这样做时

git push heroku master

我收到以下错误:

remote: -----> Python app detected
remote:  !     Requested runtime (python-3.8) is not available for this stack (heroku-18).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to djangomessagesapi.
remote: 
To https://git.heroku.com/djangomessagesapi.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/djangomessagesapi.git'

我已更改 runtime.txt 文件中的 python 版本,但返回相同的错误。

更新

我已经设法通过在 runtime.txt 中更改为 python 3.6 来传递它。但是在运行时我得到一个新的错误:

remote:        ERROR: Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r /tmp/build_07acbad0cae4c62609ee48dc9cec3685/requirements.txt (line 22)) (from versions: none)
remote:        ERROR: No matching distribution found for pkg-resources==0.0.0 (from -r /tmp/build_07acbad0cae4c62609ee48dc9cec3685/requirements.txt (line 22))

标签: pythondjango-rest-framework

解决方案


推荐阅读