Forums

sqlite3.OperationalError: no such table

Hello I'm having problems with SQLite3, Django in PythonAnywhere.

I'm getting a 500 no such table, here is the logs: 2022-07-13 10:31:36,625: Internal Server Error: /ajax/getDailyChallengeActors Traceback (most recent call last): File "/home/CiaranDoherty/.virtualenvs/sixenv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/home/CiaranDoherty/.virtualenvs/sixenv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, callback_args, *callback_kwargs) File "/home/CiaranDoherty/WebProj/sixdegrees_app/views.py", line 90, in getDailyChallengeActors actorsIds = cursor.execute(query, parameters).fetchall() sqlite3.OperationalError: no such table: sixdegrees_app_dailychallengeactors

I tried to set absolute path in the settings.py, also syncdb and migrate nothing worked out :(

Please can anyone help?

Best regards and thanks in advance

The most likely cause of missing tables with a SQLite database is if you specify the location of the DB file using a relative path -- that is, with a filename like "my.db" rather than "/home/CiaranDoherty/something/my.db". The reason for that is that "my.db" will refer to different filesystem locations depending on the current process's working directory, so sometimes you'll be accessing one databases and other times you'll be accessing a different one. This help page has more details, and some suggested fixes.