Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is sqlite bundled into Django?

Tags:

sqlite

django

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

like image 643
Andriy Drozdyuk Avatar asked Feb 02 '26 03:02

Andriy Drozdyuk


1 Answers

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.

like image 114
Bob Avatar answered Feb 04 '26 19:02

Bob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!