Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

451
Visualizações
OperationalError at / unable to open database file Appears Sporadically

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?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I fixed it by running the following two commands from within the directory where the DB file was stored:

sudo chown apache:www db.sqlite3

sudo chown apache:www .

This did it for me for AWS EC2 with Amazon Linux (CentOS)

over 4 years ago · Santiago Trujillo Relatório

0

You set the name of your DB to the full path. Don't do this. Just say 'NAME': 'db.sqlite3'

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda