3

Does Django come with sqlite bundled or is it a separate module?

Can't figure this out, even by looking at Django source: https://code.djangoproject.com/browser/django/trunk/django/db/backends/sqlite3

3 Answers 3

5

You're looking for this:

21  try:
22      try:
23          from pysqlite2 import dbapi2 as Database
24      except ImportError, e1:
25          from sqlite3 import dbapi2 as Database
26  except ImportError, exc:
27      from django.core.exceptions import ImproperlyConfigured
28      raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)

It first attempts to import PySqlite, an external module. If that fails, it tries to import the sqlite3 module included in Python 2.5+. If neither Python 2.5+ nor the external module are installed, it fails. It does not include its own copy.

0
4

Sqlite is part of the Python standard library, so it is always available to Django.

3

I think SQLite comes standard with Python 2.5+ - so it doesn't need to be bundled with Django.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.