9👍
Based on your description this has something to do with the Apache and it’s permissions to access the database. You didn’t mention which OS you use but if it is running SELinux the default rules prevent apache from connecting to db. If this is the case you can temporarily enable it by running:
setsebool httpd_can_network_connect_db
Here are more detailed instructions.
5👍
To make changes persistent across reboots (tested on Centos):
setsebool -P httpd_can_network_connect_db on
read more here
- [Django]-Django filters, got an unexpected keyword argument
- [Django]-Django: Using 2 different AdminSite instances with different models registered
- [Django]-Django query for many to many relationship
- [Django]-Caught DoesNotExist while rendering: Photo matching query does not exist
- [Django]-UserWarning: Module _mysql was already imported from /usr/lib/pymodules/python2.6/_mysql.so
0👍
Tested on CentOs.
service httpd stop
service postgresql stop
setsebool -P httpd_can_network_connect 1
service httpd start
service postgresql start
- [Django]-How do I write an update join postgres query as queryset in Django 1.9?
- [Django]-Django: Using 2 different AdminSite instances with different models registered
- [Django]-What's the correct include path in this template?
0👍
Giving the wrong authentication credentials to the Django application can lead to this problem. In order to solve it, you can follow these steps:
-
Check that Postgres is installed:
apt show postgresql
-
Check that PostgreSQL is running:
sudo service postgresql status
-
Check that you can actually connect to PostgreSQL
sudo su - postgres
-
Once in user postgres run the command interface
psql
-
Check the connection info by running:
\conninfo
In my case, I installed Postgres long ago and just forgot access information like username, password, name of database or port access.