我一直运行到不能够连接到数据库的问题:不能与Bitnami Django的连接Postgres数据库堆栈
psycopg2.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432”?
我做了一些阅读和它看起来像这是一个很常见的问题,大多数人通过检查端口是否正确来解决问题,比如在setup.py中将5432更改为5433。但是这似乎并不是我的问题 - 在/ opt/bitnami/postgresql目录中我看到.s.PGSQL.5432。我可以登录到psql,它似乎正常工作。我认为默认的数据库名称是postgresql,但我也尝试过使用名为djangostack的数据库,它也没有工作。在Django的setting.py我的数据库中的信息是这样的:
DATABASES = {
'default': {
'ENGINE': 'postgresql_psycopg2', #'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'postgres', # Or path to database file if using sqlite3.
'USER': 'postgres', # Not used with sqlite3.
'PASSWORD': 'bitnami', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '5432', # Set to empty string for default. Not used with sqlite3.
}
我期待在/ tmp /目录下并没有任何那里,隐藏或以其他方式。应该有吗?有谁知道我做错了什么?我愚蠢地覆盖了原来的示例项目,所以我看不到这些设置在那里。
非常感谢,亚历克斯
对不起,我应该补充一点,我正在ec2上运行Bitnami Django 1.3 AMI,如[链接]底部所示(http://bitnami.org/stack/djangostack)。 – 2011-05-23 19:55:15
你安装了postgresql吗?你开始了吗?你能用pgsql或pgAdmin这样的客户端连接到它吗? – Eelke 2011-05-23 20:10:44
是的,它默认安装在AMI上,我可以用psql连接它。 – 2011-05-23 21:58:25