1๐
Use forward slashes or r''
strings to begin with.
'default': {
# [... snip ...]
'NAME': 'D:/database.db',
# (or...) 'NAME': r'D:\database.db',
# [... snip ...]
}
Additionally you need to ensure the entire directory your Sqlite file is in is writable (in this case D:/
), as Sqlite needs to write its journal file next to the database file.
๐คAKX
1๐
This works for me
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'c:/projects/blog/first.db',
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Not used with sqlite3.
'PORT': '', # Not used with sqlite3.
}
}
๐คeosorio
0๐
Try using only the name of the database file (no path). By default, Django will place it in the same directory as manage.py
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'database.db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
๐คjfmancilla
- [Answered ]-Reverse for 'index' with arguments '()' and keyword arguments '{}' not found
- [Answered ]-Issue in search and display the report
- [Answered ]-Diagnosing a Sporadic Django/ Postgres "DatabaseError: current transaction is aborted"
- [Answered ]-How to check multiplicity in Django template
- [Answered ]-Django queryset filter by post variable
Source:stackexchange.com