PostgreSQL 12或更高版本是必需的(发现11.19)

huangapple go评论69阅读模式
英文:

django.db.utils.NotSupportedError: PostgreSQL 12 or later is required (found 11.19)

问题

我在尝试在本地运行我的Django服务器时遇到了这个错误:“django.db.utils.NotSupportedError: 需要PostgreSQL 12或更高版本(找到11.19)”。本地Django服务器连接到托管在ElephantSQL上的PostgreSQL实例。

我已经安装了psycopg2-binary==2.9.6。

但当我运行“python manage.py runserver”时,我收到错误消息:“django.db.utils.NotSupportedError: 需要PostgreSQL 12或更高版本(找到11.19)”。我尝试使用Homebrew升级了我的计算机上的PostgreSQL,升级到了12.5。这并没有解决问题,因为我仍然收到相同的错误(仍然提到11.19)。我不知道这个11.19是指哪个PostgreSQL实例,以及如何将其更新到12或更高版本。

有什么想法吗?

注意-另一个关于此问题的Stack Overflow帖子建议将我的Django版本从4降级到3,但这似乎是解决问题的不良方式。

英文:

I am getting this error when I try to run my django server locally: "django.db.utils.NotSupportedError: PostgreSQL 12 or later is required (found 11.19).". The local django server is connected to a postgres instance hosted on ElephantSQL.

I have installed psycopg2-binary==2.9.6.

But when I run "python manage.py runserver", I get the error "django.db.utils.NotSupportedError: PostgreSQL 12 or later is required (found 11.19).". I tried upgrading my computer's postgres with homebrew, up to 12.5. This did not fix the problem, as I still get the same error (which still mentions 11.19). I do not know what instance of postgres this 11.19 refers to, and how to update it to 12 or above.

Ideas?

Note- another stack overflow post about this suggested downgrading my django version from a 4 to a 3, but this seems like a bad way to fix it.

答案1

得分: 3

你需要降低你的Django版本或者升级你的PostgreSQL版本。我认为降低Django版本会更容易。为此,你可以执行以下操作:

pip uninstall django

卸载后,你需要重新安装较低版本的Django,可以使用以下命令:

pip install django==4.1

Django 4.2 不支持低于12的PostgreSQL版本(正如你所说你使用的是Django 4.2),但Django 4.1 可以使用PostgreSQL 11.xx。这是文档链接:

对于Django 4.2:
https://docs.djangoproject.com/en/4.2/ref/databases/#postgresql-notes

对于Django 4.1:
https://docs.djangoproject.com/en/4.1/ref/databases/#postgresql-notes

英文:

You need to downgrade your Django or upgrade your PostgreSQL version. I think downgrading django will be easier. For that you can do the following:

pip uninstall django

After uninstalling, you need to reinstall django but of lower version, for that you can use the following command:

pip install django==4.1

Django 4.2 does not support PostgreSQL lower than 12(as you said that you have Django 4.2), but Django 4.1 can use PostgreSQL 11.xx. Here is the documentation:

for Django 4.2:
https://docs.djangoproject.com/en/4.2/ref/databases/#postgresql-notes

for Django 4.1:
https://docs.djangoproject.com/en/4.1/ref/databases/#postgresql-notes

huangapple
  • 本文由 发表于 2023年6月1日 05:48:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76377514.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定