Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django error opening SQLite3 db file on when running off Apache

I got this error:

OperationalError at /

unable to open database file

Things I've tried so far are setting the absolute path of my dev.db file in the settings.py. I've tried adding www-data to my admin group and setting the group of my project folder to the admin, and setting the group to www-data, none of which solved the problem.

I'm completely stuck here, if anyone has a solution it would be MUCH appreciated!

Shawn

like image 853
shawnjan Avatar asked Nov 14 '09 02:11

shawnjan


People also ask

Why SQLite Cannot open database file?

If SQLite is unable to open the database file, this means that the SQLite database you are trying to open is corrupted. There are various causes of corruption, such as file overwrite issues, file locking issues, database synchronization failures, storage media failures, and many more.

Is SQLite good for Django?

It is not impossible to use Django with Sqlite as database in production, primarily depending on your website/webapp traffic and how hard you hit your db (alongside what kind of operations you perform on it i.e. reads/writes/etc).


1 Answers

Just passed the last 30 minutes banging my head on this problem ..

Solution

In your settings.py:

DATABASE_NAME = '/absolute/path/to/your/database.db'

Setting rights:

chown www-data /absolute/path/to/your/
chown www-data /absolute/path/to/your/database.db
like image 131
h3. Avatar answered Oct 01 '22 19:10

h3.