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
re-publishing
improve this concern
follow
edited Apr 22 "14 at 14:34

*

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

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

7 answers 7


active oldest Votes
83
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.


re-publishing
boost this price
monitor
edited Apr 2 "14 in ~ 13:23
*

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

JohnJohn
5,1172525 silver- badges3131 bronze title
6
| display 1 more comment
21
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.


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

chhantyalchhantyal
10.9k77 yellow badges4646 silver badges7373 bronze title
add a comment |
10
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.


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

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


re-publishing
enhance this prize
monitor
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 |
5
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.


share
enhance this price
follow
answer Apr 26 "15 in ~ 19:05
learninglooplearningloop
2,27933 yellow badges2626 silver- badges3535 bronze badges
1
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.
–user7179686
Oct 16 "17 at 21:27
add a comment |
2
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.


share
improve this price
follow
answer Dec 26 "20 in ~ 4:15
rick debboutrick debbout
36811 gold badge33 silver- badges1616 bronze badges
include a comment |
1
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...


re-publishing
improve this answer
follow
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
submit

Post together a guest


name
email Required, yet never shown


Post together a guest


name
email

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
Linked
2
Django: unable to open database paper (is this a pathname issue?)
1
Unable to open up database record - Mayan EDMS
0
apache flask sqlite can not to open database document on ubuntu
0
Cannot access an sqlite3 database record with python
0
Unable to accessibility sqlite database top top server
0
OperationalError in ~ / unable to open database record Appears Sporadically
0
Changing paper permissions because that Apache - Django
1
sqlite + python: cannot update record
associated
6372
exactly how do I check whether a document exists there is no exceptions?
1282
How can I list the tables in a SQLite database file that was opened with ATTACH?
3086
exactly how do i copy a document in Python?
3151
improve INSERT-per-second power of SQLite
2026
just how to review a document line-by-line right into a list?
1812
just how do girlfriend append to a file?
2687
how to delete a document or folder in Python?
2025
Why is analysis lines from stdin lot slower in C++ 보다 Python?
0
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.


default
stack Overflow
commodities
agency
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.