How to Fix – Operational Error: cannot open database in Django Sqlite3

This may be a permission problem.

the database file must be writable to the user

you need to grant permission to db.sqlite3

here, myproject is the folder which contains db.sqlite3 file

chmod 664 /path/to/myproject/db.sqlite3
sudo chown :www-data /path/to/myproject/db.sqlite3
sudo chown :www-data /path/to/myproject

also give necessary permissions to the folder that contains the sqlite3 database file. the database engine should be able to write a lockfile to the parent directory of the database file.

sudo chmod 775 /path/to/myproject

Leave a Reply

Your email address will not be published. Required fields are marked *