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 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?

"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

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.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct