When I run Django on Dreamhost using SQLite, why do I get an OperationalError telling me that a table doesn’t exist?

StackOverflow https://stackoverflow.com/questions/2557710

Question

I had a Django site running on Dreamhost. Although I used SQLite when developing locally, I initially used MySQL on Dreamhost, because that’s what the wiki page said to do, and because if I’m using an ORM, I might as well take advantage of it by running against a different database.

After a while, I switched the settings on the server to use SQLite, to make it easier to keep my development database in sync with the server one. python manage.py syncdb worked on the server, but when I tried to access the site, I got an OperationalError. The Django error page said that one of my tables didn’t exist.

I checked the database using sqlite on the command line on the server, and using python manage.py shell, and both worked fine.

Was it helpful?

Solution

It turned out that on the server, the DATABASE_NAME setting required a full path, e.g.

DATABASE_NAME = '/home/USERNAME/SITE/DJANGOPROJECT/DATABASE.db'

Locally (and I guess for manage.py on the server), just a filename was fine, e.g.

DATABASE_NAME = 'DATABASE.db'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top