views:

103

answers:

1

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.

+1  A: 

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'
Paul D. Waite
A helper method like this can help reduce path name tweaks between environments: `rel = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)`
istruble