summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/sqlite3')
-rw-r--r--django/db/backends/sqlite3/base.py14
-rw-r--r--django/db/backends/sqlite3/client.py3
2 files changed, 8 insertions, 9 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index ba0ef16b61..b0c087d1cd 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -149,21 +149,22 @@ class DatabaseWrapper(BaseDatabaseWrapper):
self.features = DatabaseFeatures()
self.ops = DatabaseOperations()
- self.client = DatabaseClient()
+ self.client = DatabaseClient(self)
self.creation = DatabaseCreation(self)
self.introspection = DatabaseIntrospection(self)
self.validation = BaseDatabaseValidation()
- def _cursor(self, settings):
+ def _cursor(self):
if self.connection is None:
- if not settings.DATABASE_NAME:
+ settings_dict = self.settings_dict
+ if not settings_dict['DATABASE_NAME']:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured, "Please fill out DATABASE_NAME in the settings module before using the database."
kwargs = {
- 'database': settings.DATABASE_NAME,
+ 'database': settings_dict['DATABASE_NAME'],
'detect_types': Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES,
}
- kwargs.update(self.options)
+ kwargs.update(settings_dict['DATABASE_OPTIONS'])
self.connection = Database.connect(**kwargs)
# Register extract, date_trunc, and regexp functions.
self.connection.create_function("django_extract", 2, _sqlite_extract)
@@ -172,11 +173,10 @@ class DatabaseWrapper(BaseDatabaseWrapper):
return self.connection.cursor(factory=SQLiteCursorWrapper)
def close(self):
- from django.conf import settings
# If database is in memory, closing the connection destroys the
# database. To prevent accidental data loss, ignore close requests on
# an in-memory db.
- if settings.DATABASE_NAME != ":memory:":
+ if self.settings_dict['DATABASE_NAME'] != ":memory:":
BaseDatabaseWrapper.close(self)
class SQLiteCursorWrapper(Database.Cursor):
diff --git a/django/db/backends/sqlite3/client.py b/django/db/backends/sqlite3/client.py
index 239e72f1e9..0b65444d74 100644
--- a/django/db/backends/sqlite3/client.py
+++ b/django/db/backends/sqlite3/client.py
@@ -1,10 +1,9 @@
from django.db.backends import BaseDatabaseClient
-from django.conf import settings
import os
class DatabaseClient(BaseDatabaseClient):
executable_name = 'sqlite3'
def runshell(self):
- args = ['', settings.DATABASE_NAME]
+ args = ['', self.connection.settings_dict['DATABASE_NAME']]
os.execvp(self.executable_name, args)