I get this error when setup up a server in Django. The is sqlite3 which way it should produce the .db record but the doesn"t it seems ~ to be doing so. I"ve stipulated SQLite together the backend and also an absolute file path for where to placed it, yet no luck.

You are watching: Sqlite3.operationalerror: unable to open database file

Is this a an insect or am i doing something incorrect? (Was simply thinking, is the absolute file path specified in different way in Ubuntu?)

Here is the start of my settings.py file:

# Django settings for OmniCloud project.DEBUG = TrueTEMPLATE_DEBUG = DEBUGADMINS = (# ("Your Name", "your_email
example.com"),)MANAGERS = ADMINSDATABASES = "default": "ENGINE": "django.db.backends.sqlite3", # include "postgresql_psycopg2", "postgresql", "mysql", "sqlite3" or "oracle". "NAME": "~/Harold-Server/OmniCloud.db", # Or route to database document if making use of sqlite3. "USER": "", # Not supplied with sqlite3. "PASSWORD": "", # Not offered with sqlite3. "HOST": "", # set to empty string for localhost. Not offered with sqlite3. "PORT": "", # collection to north string because that default. Not supplied with sqlite3.
python database django sqlite django-settings
improve this concern
edited Apr 22 "14 at 14:34


Martijn Pieters♦
918k253253 gold badges36343634 silver badges30733073 bronze title
inquiry Oct 6 "11 at 4:25

11.1k1818 gold badges8484 silver- badges142142 bronze badges
include a comment |

7 answers 7

active oldest Votes
Django NewbieMistakes

PROBLEM You"re making use of SQLite3, her DATABASE_NAME is set to the database file"s full path, the database document is writeable by Apache, but you still gain the over error.

SOLUTION Make certain Apache can additionally write to the parent magazine of the database. SQLite requirements to be able to write to this directory.

Make sure each folder of your database file"s full path go not start with number, eg. /www/4myweb/db (observed on windows 2000).

If DATABASE_NAME is collection to something prefer "/Users/yourname/Sites/mydjangoproject/db/db", make certain you"ve developed the "db" brochure first.

Make certain your /tmp magazine is world-writable (an unlikely reason as various other thing on your system will additionally not work). Ls /tmp -ald should produce drwxrwxrwt ....

Make certain the course to the database mentioned in settings.py is a complete path.

Also make sure the paper is present where you expect it to be.

boost this price
edited Apr 2 "14 in ~ 13:23

1,34911 gold badge1919 silver- badges3030 bronze title
reply Oct 6 "11 at 5:37

5,1172525 silver- badges3131 bronze title
| display 1 more comment
I challenged exactly exact same issue. Here is my setting which worked.

"ENGINE": "django.db.backends.sqlite3", "NAME": "/home/path/to/your/db/data.sqlite3"Other setting in instance of sqlite3 will be same/default.And you require to create data.sqlite3.

enhance this answer
edited Feb 19 "13 at 10:15
reply Jun 28 "12 at 10:37

10.9k77 yellow badges4646 silver badges7373 bronze title
add a comment |
You haven"t specified the absolute course - you"ve provided a shortcut , ~, which could not occupational in this context. Usage /home/yourusername/Harold-Server/OmniCloud.db instead.

boost this price
answer Oct 6 "11 in ~ 8:11
Daniel RosemanDaniel Roseman
553k5757 yellow badges787787 silver badges810810 bronze title
include a comment |
You must use complete path instead of ~/.

In your case, something like /home/harold/Harold-Server/OmniCloud.db.

enhance this prize
edited Aug 8 "13 at 23:38
kris McFarland
5,88755 yellow badges4444 silver- badges6161 bronze title
reply Aug 8 "13 in ~ 23:18
Stanislav BondarenkoStanislav Bondarenko
6111 silver- badge11 bronze argorial
include a comment |
In my situation the sqlite db document db.sqlite3 to be stored in the DocumentRoot that apache. So, even after setting the adhering to permissions it didn"t work:

sudo chown www-data:www-data /path/to/db-foldersudo chown www-data:www-data /path/to/db-folder/sqlite-db.dbFinally as soon as i relocated db.sqlite3 to a newly created folder dbfolder under DocumentRoot and also gave the above permissions, and it worked.

enhance this price
answer Apr 26 "15 in ~ 19:05
2,27933 yellow badges2626 silver- badges3535 bronze badges
This worked for me perfect from root user - making use of a flask application to affix to the db from in ~ the project directory. Operated a charm - just need to gain apache able to talk v the db.
Oct 16 "17 at 21:27
add a comment |
I had actually this problem serving v Apache and also found that making use of the absolute path to the sqlite3 db in mine .env //// as opposed to utilizing the family member path /// addressed the problem. All of the permissions and also ownership mentioned over are crucial as well.

improve this price
answer Dec 26 "20 in ~ 4:15
rick debboutrick debbout
36811 gold badge33 silver- badges1616 bronze badges
include a comment |
use this type it functions for me . Home windows 7 through python 2.7 and also django 1.5

"ENGINE": "django.db.backends.sqlite3","NAME": "C:\\tool\\mysite\\data.db",hope its works...

improve this answer
answered may 30 "13 at 1:30
Yogendra SharmaYogendra Sharma
1133 bronze badges
add a comment |

her Answer

Thanks for contributing solution to ridge Overflow!

Please be certain to answer the question. Carry out details and also share her research!

But avoid

Asking because that help, clarification, or responding to various other answers.Making statements based on opinion; earlier them increase with recommendations or personal experience.

To discover more, see our tips on writing great answers.

See more: Blank Double Ten Frame - Double Ten Frame Template By Works Of Heart

Draft saved
Draft discarded

Sign up or log in

authorize up using Google
sign up utilizing Facebook
authorize up using Email and Password

Post together a guest

email Required, yet never shown

Post together a guest


Required, yet never shown

article Your answer Discard

By clicking “Post your Answer”, girlfriend agree to our terms of service, privacy policy and also cookie policy

Not the prize you're feather for? Browse other questions tagged python database django sqlite django-settings or asking your own question.

The Overflow Blog
Upcoming occasions
Featured top top Meta
Django: unable to open database paper (is this a pathname issue?)
Unable to open up database record - Mayan EDMS
apache flask sqlite can not to open database document on ubuntu
Cannot access an sqlite3 database record with python
Unable to accessibility sqlite database top top server
OperationalError in ~ / unable to open database record Appears Sporadically
Changing paper permissions because that Apache - Django
sqlite + python: cannot update record
exactly how do I check whether a document exists there is no exceptions?
How can I list the tables in a SQLite database file that was opened with ATTACH?
exactly how do i copy a document in Python?
improve INSERT-per-second power of SQLite
just how to review a document line-by-line right into a list?
just how do girlfriend append to a file?
how to delete a document or folder in Python?
Why is analysis lines from stdin lot slower in C++ 보다 Python?
Django Crm no running
hot Network concerns much more hot concerns

inquiry feed
subscribe to RSS
inquiry feed To i ordered it to this RSS feed, copy and also paste this URL into your RSS reader.

stack Overflow
ridge Exchange Network
site architecture / logo © 2021 stack Exchange Inc; user contributions license is granted under cc by-sa. Rev2021.10.15.40479

Stack Overflow works finest with JavaScript enabled

her privacy

By click “Accept every cookies”, friend agree stack Exchange can store cookies on your machine and disclose details in accordance through our Cookie Policy.