Back
I have been doing some repetitive processes in my application (testing it), and suddenly I’m receiving a weird error:
OperationalError: database is locked
I have restarted the server as well, but still, the error persists.
What is it all about?
The practical reason for this is usually that the python or django shells have opened a request to the DB and it has not been closed properly; killing your terminal access usually frees it up. I am getting this error on running command line tests today.
If you want to kill access without rebooting the terminal, then from commandline you can do:
from django import db db.connections.close_all()
Interested in SQL ? Check out this SQL Certification course by Intellipaat.
31k questions
32.8k answers
501 comments
693 users