How to set apache permissions for a Postgresql in Ubuntu for a Django project?
Ok so I did not set apache permissions for db.sqlite3 as I intend to use postgresql, but I did give permission to my whole django project folder.
Now, should I just make a postgresql user and a db and assign the credentials in the settings.py and leave it like that? Also, I'm not really sure what to put in the "HOST" and "PORT" entries if that's the case?
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": 'mydbname_db',
"USER": 'myuser',
"PASSWORD": 'mypass',
"HOST": "",
"PORT": "",
}
}
1 Reply
You have the right idea! You'll want to create a PostgreSQL user, create a database and give access to your new user, then allow database access in settings.py
.
The default port for PostgreSQL is 5432, and you'll want to enter that port number for PORT
unless you've changed it in your other configurations. Your HOST
entry should likely be localhost
.
This resource may be helpful as it provides step-by-step instructions for connecting your PostgreSQL database to Django.