Forums

Django CMS install not recognizing SQLite DB table

I have a problem with a fresh Django CMS instance that I recently installed. It comes with its own SQLite DB and the response to an HTTP GET request is no such table: cms_urlconfrevision. After the first time that I saw the problem I performed a DB migration and then used the sqlite3 CLI to verify that the table cms_urlconfrevision does indeed exist. I "reloaded" the site from the pythonanywhere Web app config tab. Is there some other way to "bounce" a Django CMS instance? Does anyone have any guesses as to what could be going on and how to fix it? If you want to see the error page just go to https://newamericanmodelbond.pythonanywhere.com/ where there is a lot of diagnostic information.

It seems as you have to makemigrations and migrate if you have done that try flushing the database and migrate it again

What code do you have to specify the database file's location? It will be in your settings.py file.

After doing more research I identified the problem. The DB file location needed to be updated in settings.py. I updated the value of 'NAME' in the DATABASES section to be the absolute path to the project database. I'm sure that there is a more elegant solution that involves using an environment variable. I'll look into that, but for now this problem is solved.

Great, glad you worked it out! Normally Django will define a variable called BASE_DIR in settings.py, which is the absolute path to the directory containing manage.py, so good practice with SQLite databases is to use that in combination with os.path.join to construct a system-independent path to your database.