I’ve done this set up a 1000 times, new to digitalocean… I’ve set up a server with Django/posgresql/apache/mod_wsgi… I use pyscopg2 to connect to postgresql from django. Everything works fine execept I can’t connect to postgresql when running under apache/mod_wsgi. I’ve been successful at running django app server and connecting to app locally with lynx. So issue is isolated to mod_wsgi… I have no idea why I can’t connect I’m assuming it’s permission to access postgresql socket … but not sure… postgresql socket resides in /tmp.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Some more details would help. Are you getting any error output that could help us run this down, a traceback or something in /var/log/apache2/error.log ?
I’m getting the following error from apache log: <br> <br>“”“OperationalError at / <br> <br>could not connect to server: No such file or directory <br> Is the server running locally and accepting <br> connections on Unix domain socket “/tmp/.s.PGSQL.5432”? <br>”“” <br>Everything works perfectly with test server, ie: postgresql is up and running fine… in pgsql log no connection attemp recorded.
That looks like a file permissions error. That would explain why you can use the Django server, but not Apache. Your user has the correct permissions to access the socket, so when you connect using the built-in Django server it works. The Apache process is running under a different user (www-data), nad it doesn’t seem to have the correct permissions. <br> <br>What’s the output of: <br> <br>grep unix_socket /etc/postgresql/9.1/main/postgresql.conf
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.