I am getting the following error when I try to run a Django site in production:
OperationalError at / unable to open database file
The strangest part is that it worked for a few page reloads and even clicks on different navigation links. Then, it worked every other time or so. At the end, it stopped working all together. This behavior is very puzzling.
Here is the relevant piece from settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
I have done chmod 777 db.sqlite
as well as chmod o+w .
within the directory where db.sqlite3
is located. It did not help.
How could I fix this? I am using a basic EC2 instance with Linux and Apache 2.4
Edit:
I have just duplicated the entire directory of the project using cp project project1
and then did mv project1 project
. This made the site work for a few clicks, but then the error started creeping in again. Could this be a server issue?