Skip to content Skip to sidebar Skip to footer

Python Sqlite3 Operationalerror: Attempt To Write A Readonly Database

I am trying to run a Flask REST service on CentOS Apache2 using WSGI. The REST service requires a very small storage. So i decided to use SQLite with sqlite3 python package. The wh

Solution 1:

In addition to changing the database file permissions, you need also to change permissions for the directory that hosts the database file. You can try the following command:

chmod 664 /path/to/your/directory/

You can also change the directory's owner as follows:

chown apache:apache /path/to/your/directory/

Solution 2:

What worked for me (I don't have sudo) was removing the database file and all migrations and starting again, as described here: How do I delete DB (sqlite3) in Django 1.9 to start from scratch?

Solution 3:

run

sudo chmod 774 path-to-your-djangoproject-directory 

The directory should be the one which contains manage.py and db.sqlite3 files. (the parent container).

Worked in my case.

Post a Comment for "Python Sqlite3 Operationalerror: Attempt To Write A Readonly Database"