我的网站运行正常。我关闭了服务器以升级内存和内核。在再次打开之后,我遇到了500错误。切换到调试模式后,它返回以下内容:
OperationalError at /
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.5433"?
Request Method: GET
Request URL: http://mysite.nl/
Django Version: 1.6.11
Exception Type: OperationalError
Exception Value:
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.5433"?
Exception Location: /data_nfs/opensurfaces/venv/local/lib/python2.7/site-packages/psycopg2/__init__.py in connect, line 130
Python Executable: /data_nfs/opensurfaces/venv/bin/python
Python Version: 2.7.6
我正在运行Ubuntu 14.04,其中包含由nginx,gunicorn和postgresql托管的django应用程序。看来我需要将套接字连接到服务器?我怎么能这样做?
看似相关的question告诉我删除文件,但我没有这个文件。
答案 0 :(得分:2)
事实证明sudo service postgresql restart
没有做到这一点。相反,我使用sudo -u postgres /etc/init.d/postgresql restart
重启它,这确实有效。