python sqlite3 OperationalError: attempt to write a readonly database

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/

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?