10👍
Just changing the database ownership worked for me.
ALTER DATABASE database OWNER TO user;
8👍
This is happening due to the access issue of the role to the public
schema. Running this script inside the database shell will solve the issue.
GRANT ALL ON SCHEMA public TO your_user;
GRANT ALL ON SCHEMA public TO public;
This is for Postgres DB. A similar script can be found for other SQL DB.
- Configuring root logger in python
- Django import-export: only export
- CSRF verification Failed – Referer is insecure while host is secure
- Django; is it possible to have a default value for queryset
1👍
Check the user created earlier after db creation and the one set in DATABASES configurations in settings.py
is matching. Lets call it as myuser and the db created as mydb
Apply below permissions to the user –
GRANT ALL ON DATABASE mydb TO myuser;
ALTER DATABASE mydb OWNER TO myuser;
GRANT USAGE, CREATE ON SCHEMA PUBLIC TO myuser;
0👍
I was able to GRANT USAGE
and GRANT CREATE
when I simply entered psql using the psql
command instead of python manage.py dbshell
. I subsequently ran into errors relating to the owner of the objects in the database (relations, etc.) not being the one in the DATABASES['USER']
settings, namely, 'lucyapp'
.
I finally resolved the issues using pg_restore
with the --no-owner
and --role=lucyapp
options, following Postgresql – backup database and restore on different owner?.