我如何连接我的Django应用程序到Postgres数据库?



如何连接我的Django应用程序到Postgres数据库?

每当我在修改后运行python manage.py makemigration时,我就会得到这种错误。我该怎么修理它?

Got an error checking a consistent migration history performed for database connection 'default': connection to server 
at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061)
Is the server running on that host and accepting TCP/IP connections?
warnings.warn(
No changes detected

似乎你的postgres服务器没有运行。我建议你确保postgres服务器正在运行,并且你可以连接到它。

您可以使用您的终端或任何数据库工具,如PgAdmin, DBeaver, Tableplus等。在您能够通过上述任何一种方式连接到数据库之后。Django数据库连接应该没有问题。

你可以从

得到帮助https://tableplus.com/blog/2018/10/how-to-start-stop-restart-postgresql-server.html
  • https://www.enterprisedb.com/postgres-tutorials/connecting-postgresql-using-psql-and-pgadmin

相关内容

最新更新