首页 > 解决方案 > Heroku 不升级 python 版本

问题描述

我正在尝试在 Heroku 中部署一个 django 项目,但该包django-mongoengine需要 python 版本> = 3.7。
我已经runtime.txt使用 Heroku 的可用 python 版本之一声明了该文件,但是当我部署项目时,python-3.6.12 仍在安装中。

Total 4 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Python app detected
remote: -----> Installing python-3.6.12
remote: -----> Installing pip 20.1.1, setuptools 47.1.1 and wheel 0.34.2
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting Django==3.0.5
remote:          Downloading Django-3.0.5-py3-none-any.whl (7.5 MB)
remote:        Collecting django-mongoengine==0.4.4
remote:          Downloading django-mongoengine-0.4.4.tar.gz (186 kB)
remote:          Installing build dependencies: started
remote:          Installing build dependencies: finished with status 'done'
remote:          Getting requirements to build wheel: started
remote:          Getting requirements to build wheel: finished with status 'done'
remote:            Preparing wheel metadata: started
remote:            Preparing wheel metadata: finished with status 'done'
remote:        ERROR: Package 'django-mongoengine' requires a different Python: 3.6.12 not in '>=3.7'
remote:  !     Push rejected, failed to compile Python app.

我的运行时文件的内容是:

python-3.7.9

我的 Procfile 文件是:

web: gunicorn graffitisWeb.wsgi

另外项目的结构是:


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        02/12/2020     10:13                ayuntamientoApp
d-----        22/01/2021     17:25                clienteApp
d-----        02/12/2020     10:13                Ejemplos bd
d-----        21/01/2021      9:55                graffitiApp
d-----        21/01/2021      9:56                graffitisWeb
-a----        21/01/2021      9:55            314 .gitignore
-a----        23/11/2020     13:05            653 manage.py
-a----        21/01/2021     11:24             31 Procfile
-a----        21/01/2021      9:55           4490 README.md
-a----        22/01/2021     18:04           2412 requirements.txt
-a----        22/01/2021     18:11             12 runtime.txt

我做错了什么吗?还是这是 Heroku 的问题?谢谢。

标签: pythondjangoheroku

解决方案


推荐阅读