. Advertisement .
..3..
. Advertisement .
..4..
This morning, when I am running my program, I get the error ”no such table: django_session”.
On my server, two Django websites are active, both through Apache and using various virtual hosts on two ports that are supplied by my Nginx frontend (using for static files). One website operates perfectly well and uses MySql. The other encounters the problem in the title and uses Sqlite3.
The mysite.sqlite3 (SQLite database in this directory) file has a django session table with valid data in it, according to a copy of sqlite.exe that I obtained. Both the site-packages folder and sqlite.exe are located in my Python path’s system32 directory.
Here is a section of my settings.py file:
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mysite.sqlite3', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
Can someone give me some advice?
The cause: It’s possible that the server and the manage.py command utilize separate working directories. The sqlite database is generated in the working directory since you specify a relative path for it.
Solution: Try it using a path that is absolute, like:
Keep in mind that you must either execute
./manage.py syncdb
once more or copy your current database and its tables to/tmp
.If that fixes the error, you can look for a more suitable location than
/tmp