Reputation: 16469
I get the error
OperationalError: unable to open database file
The path leading to my .db file is
~/Development/Django/django_prac/practice/database
Here is my Settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '/Home/Development/Django/django_prac/practice/database/practice.db', # Or path to database file if using sqlite3.
# The following settings are not used with sqlite3:
'USER': '',
'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default.
}
}
I have also tried
~/Development/Django/django_prac/practice/database$
in my 'NAME' but yet same error occurs
Upvotes: 3
Views: 6767
Reputation: 2247
OK, that is my suggestion:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'practice.db', # Just the name
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
I think you maybe have an error in the path, try pwd
over /Home/Development/Django/django_prac/practice/database/
directory and copy the output.
Then plus the db name
hope helps
Upvotes: 3