2

I am trying to deploy my Django project on a Bitnami server, but when I try to login through admin with my superuser i get the following error:

attempt to write a readonly database
Exception Location: /opt/bitnami/python/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py, line 413, in execute

I have the following permissions to my project files:

drwxrwxr-x 6 bitnami www-data   4096 Mar 12 08:01 .
drwxr-xr-x 3 bitnami root       4096 Mar 11 10:00 ..
drwxr-xr-x 2 bitnami bitnami    4096 Mar 11 11:48 conf
-rw-rw-r-- 1 bitnami www-data 147456 Mar 12 08:01 db.sqlite3
-rw-r--r-- 1 bitnami bitnami     287 Mar 11 13:29 .env
drwxr-xr-x 5 bitnami bitnami    4096 Mar 11 10:26 app
-rwxr-xr-x 1 bitnami bitnami     667 Mar 11 10:00 manage.py
drwxr-xr-x 3 bitnami bitnami    4096 Mar 11 13:52 django_project
drwxr-xr-x 5 bitnami bitnami    4096 Mar 11 10:26 users

and this to the project directory

drwxrwxr-x  6 bitnami www-data 4096 Mar 12 08:01 django_project

I tried to run the following to give permission but without luck:

sudo chown :www-data /opt/bitnami/projects/django_project/db.sqlite3
sudo chmod 664 /opt/bitnami/projects/django_project/db.sqlite3
sudo chown :www-data /opt/bitnami/projects/django_project/
sudo chmod 775 /opt/bitnami/projects/django_project/

Can you help me? :)

Frederik Petri
  • 451
  • 8
  • 24
  • Does this answer your question? [Change SQLite database mode to read-write](https://stackoverflow.com/questions/1518729/change-sqlite-database-mode-to-read-write) – Abdul Aziz Barkat Mar 12 '21 at 08:19
  • I tried multiple solutions, also some given in the question you linked to, however without luck. Also I am very new to both sqlite and linux so some of the points like "Make sure that the directory containing the database file is also writable to the user executing the CGI script." I dont know how to do – Frederik Petri Mar 12 '21 at 09:42
  • Bitnami developer here. You setting the group to www-data. The Bitnami Apache user is "daemon". – Michiel d'Hont Mar 12 '21 at 14:31
  • Hi Michiel. Thanks a lot for helping it works! If you want, you can make it as an answer so I can accept it – Frederik Petri Mar 14 '21 at 19:04

1 Answers1

1

Bitnami developer here. You are setting the group to www-data. The Bitnami Apache user is "daemon".

Michiel d'Hont
  • 316
  • 1
  • 3