我花了几个小时来解决这些问题,但没有解决任何问题。网上有几个关于这个问题的话题,但没有一个说绝对可以解决这个问题。
我刚刚安装了 postgresql 以便在我的 django 项目中使用它。
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2", # Add "postgresql_psycopg2", "postgresql", "mysql", "sqlite3" or "oracle".
"NAME": "name", # Or path to database file if using sqlite3.
"USER": "postgres", # Not used with sqlite3.
"PASSWORD": "pass", # Not used with sqlite3.
"HOST": "", # Set to empty string for localhost. Not used with sqlite3.
"PORT": "", # Set to empty string for default. Not used with sqlite3.
}
}
这是我的 settings.py,错误是
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.5432"?
有人对此有解决方案吗?