Install & Compatibility
Where this runs
tested against v1.3.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 70MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 5.1s · import 0.000s · 71MB
69MB installed
● package 69MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
djongo
✓ import djongo
✗ from djongo import ...
Typically you don't import djongo directly; you just add it to INSTALLED_APPS
Configure Django to use MongoDB via djongo as the database engine.
# settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'djongo', # add djongo
]
DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'your-db-name',
'ENFORCE_SCHEMA': True,
'CLIENT': {
'host': os.environ.get('MONGO_HOST', 'localhost'),
'port': int(os.environ.get('MONGO_PORT', 27017)),
'username': os.environ.get('MONGO_USER', ''),
'password': os.environ.get('MONGO_PASS', ''),
}
}
}
Errors
Common errors & fixes
django.core.exceptions.ImproperlyConfigured: 'djongo' isn't an available database backend.
Djongo not installed or not added to INSTALLED_APPS in older versions.
fixRun 'pip install djongo' and ensure 'djongo' is in INSTALLED_APPS.
ModuleNotFoundError: No module named 'djongo'
Djongo package not installed.
fixInstall with: pip install djongo
django.db.utils.OperationalError: no such table: ...
Djongo does not support migrations with SQL-style table creation. It works collection-based.
fixRun 'python manage.py migrate' to create collections (but it may not create tables). Use 'python manage.py makemigrations' only if you have models.
Upgrade
Version history
1.3.7latest on PyPI · released Nov 12, 2024
Audit
Dependencies
DjangorequiredDjongo requires Django 2.x or 3.x, but not fully compatible with Django 4+
pymongorequiredRequired for MongoDB driver
sqlparserequiredUsed for SQL parsing