Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5

完整报错如下:

django.db.utils.OperationalError: could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Cannot assign requested address
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?

#-----------------------------------------------------------------------------------------------

根据5432可知,使用的是PostgreSQL数据库.

所以需要检查django中连接postgres的用户名和密码是否和实际数据库的连接用的用户名和密码是否一致.

另外需要检查该数据库是否存在,如果不存在,需要建立.

发布了758 篇原创文章 · 获赞 343 · 访问量 162万+

猜你喜欢

转载自blog.csdn.net/appleyuchi/article/details/104799001