运行Django的syncdb时,OSX 10.7.3上的Postgresql套接字错误 [英] Postgresql socket error on OSX 10.7.3 when running Django's syncdb

查看:159
本文介绍了运行Django的syncdb时,OSX 10.7.3上的Postgresql套接字错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于将OSX升级到10.7.3版本,当我尝试运行Djangosyncdb命令时,我从Postgresql 8.4.2收到以下psycopg2错误:

Since upgrading OSX to version 10.7.3, when I attempt to run a Django "syncdb" command, I receive the following psycopg2 error from Postgresql 8.4.2:

psycopg2.OperationalError: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

我可以在没有事件的情况下打开psql,但是当我尝试运行pg_ctl status我也收到这个错误:

I'm able to open psql without incident, but when I attempt to run "pg_ctl status", I receive this error as well:

pg_ctl: could not open PID file "/Library/PostgreSQL/8.4/data/postmaster.pid": Permission denied

有相关吗?

推荐答案

我也有同样的问题:将osx更新到10.7.3,在我重新启动postgres服务器后,我遇到同样的问题,当我试图运行 $ ./manage.py dbshel​​l 通过psycopg2,但没有连接到postgres使用psql的问题。

I had the same problem too: updated osx to 10.7.3 and after I restarted the postgres server I got the same issue when I tried to run $ ./manage.py dbshell that goes through psycopg2, but didn't have problem connecting to postgres using psql.

对我来说,问题似乎只与Unix域套接字上的连接有关,因为psycopg2使用了新的10.7.3 osx更新的postgres库。

To me the problem appears to be related just to "connections on Unix domain socket", because psycopg2 uses the newly 10.7.3 osx updated postgres library.

我尝试重新安装psycopg2,但没有被更改了。

I tried to reinstall psycopg2, but nothing was changed.

所以,我更改了django settings.py的数据库部分的HOST值,而不是h想要一个空字符串我把'localhost'

So, I changed the HOST value on the databases section of my django settings.py, and instead of having an empty string I put 'localhost'.

,它的工作完美!

这篇关于运行Django的syncdb时,OSX 10.7.3上的Postgresql套接字错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆