我正在尝试运行django迁移来更新我的数据库,但“manage.py migrate”无法连接到我的postgresql数据库。奇怪的是:我的django网站(完全相同的代码)正在工作,包括连接数据库。
错误讯息:
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/run/postgresql/.s.PGSQL.xxxxxx"?
和
django.db.utils.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL
答案 0 :(得分:-1)
解决方法:将HOST变量更改为localhost或127.0.0.1。