完整报错如下:
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的用户名和密码是否和实际数据库的连接用的用户名和密码是否一致.
另外需要检查该数据库是否存在,如果不存在,需要建立.