6

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

3
  • 1
    What is the output of "ls -l dev.db"? What OS and Django version are your running? What happens if you temporarily move the database file, then run ./manage.py syncdb? Does it create a new database, can you access that database. When you run "ls -l dev.db" does it report any difference in permissions or owner than when you ran it on your real database? Commented Nov 14, 2009 at 3:03
  • 2
    You may have changed the owner and group of www-data, but that doesn't mean it permeated down. Try chown -R you:www-data project && chmod -R g+w project. Commented Nov 14, 2009 at 4:10
  • Thanks for the suggestions guys, but I just switched to MySQL instead. Cheers! Commented Nov 14, 2009 at 23:10

1 Answer 1

8

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.