-1
Django的版本:1.5Django的 - OperationalError:无法连接到服务器
Python版本:用于运行应用程序2.7
python manage.py runserver 127.0.0.1:8000
命令和下面的异常已经产生:
OperationalError: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 8000?
Django项目的SETTINGS.py
文件包含以下数据库设置:
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'geodjango',
'USER': 'postgres',
'PASSWORD': 'postgres',
'HOST': '127.0.0.1',
'PORT': '8000',
} }
不错,但还是它的消逝例外:'psycopg2.OperationalError:无法连接到服务器:连接被拒绝 \t是运行在主机上的服务器“ 127.0.0.1“并接受 \t端口5432上的TCP/IP连接?' – 2015-01-21 06:39:33
您尝试过5433吗?你的postgres配置中设置了哪个端口? – catavaran 2015-01-21 06:43:41
是的,我尝试过。我使用'pip install'命令来安装postgresql,但它不存在于/ var/run/- whats wrong – 2015-01-21 06:48:18