这是我的 Django 项目中的 settings.py 文件。操作系统:Windows,主机:本地主机
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'postgres',
'USER': 'JESS',
'PASSWORD': 'dreamhost',
'HOST': 'localhost',
'PORT': '5432',
}
}
我按照这个博客的说明安装 PostgreSQL 和 psycopg2
http://shivul.wordpress.com/2010/05/07/installing-django-with-postgresql-on-windows-and-ubuntu/
运行时python manage.py syncdb
出现以下错误:
OperationalError: Could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432
Could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432
我什至尝试通过 PostgreSQL 安装文件中的 pgadmin3 应用程序编辑设置,它甚至抛出相同的错误
Could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432
Could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432
我查看了 stackoverflow 和 internet 中的类似问题,一切都已过时或无法正常工作。