django-cryptography
Easily encrypt data in Django
What it is and what it does
Django Cryptography provides a lightweight wrapper around the cryptography library to encrypt individual Django model fields transparently. When you wrap a field with the encrypt() function, data is automatically encrypted before storage and decrypted on retrieval, using symmetric encryption that supports bidirectional access. The package also offers a drop-in replacement for Django's built-in cryptographic primitives, allowing you to substitute cryptography as the backend provider.
The package is designed for developers who need to protect sensitive data at the field level without managing encryption keys manually or writing custom serialization logic. It integrates directly into Django's ORM, so encrypted fields behave like normal fields in queries and model definitions. Dependencies are minimal: Django, cryptography, and django-appconf for configuration management.
Use it for:
- Store personally identifiable information (names, emails, phone numbers) encrypted in the database while keeping queries simple.
- Protect payment card details or financial account numbers in a Django application without custom encryption middleware.
- Replace Django's default cryptographic backend with cryptography for stronger or more modern algorithms.
- Encrypt sensitive user preferences or medical data in healthcare or financial Django applications.
- Add field-level encryption to an existing Django project with minimal code changes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Wraps Python's cryptography library to add transparent field-level encryption to Django models, and provides a drop-in replacement for Django's own cryptographic primitives.
Yes, if you are using Django 2.2, 3.2, or 4.0 and need straightforward field-level encryption without external key management. The package is stable and has no known vulnerabilities. However, be aware that the last release was in April 2022; if you require support for newer Django versions or active maintenance, evaluate whether the dormant status aligns with your project's lifecycle.
Install
django-cryptography on PyPI
pip
pip install django-cryptographyuv
uv add django-cryptographypoetry
poetry add django-cryptographyInstalling django-cryptography
Before you install
Low install friction with a pure-Python wheel. Maintenance is dormant—last release was in April 2022—but the repository remains active and the package is marked Production/Stable. Suitable for projects that do not require frequent updates.
License in practice
BSD-3-Clause is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install django-cryptography
from django.db import models
from django_cryptography.fields import encrypt
class MyModel(models.Model):
sensitive_data = encrypt(models.CharField(max_length=50))
Requires Django 2.2, 3.2, or 4.0 and cryptography 2.0 or later; Python 3.6 or higher.
Verify before relying
- Whether the package works with Django versions released after 4.0.
- Current compatibility with cryptography versions beyond 2.0.
- Performance impact of field-level encryption on query operations.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — Django, cryptography, django-appconf |
| Maintenance | dormant — 1,591 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 197,144/month — #9,768 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_cryptography-1.1-py2.py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
django-cryptography-django5Encrypts and decrypts data in Django models…
permissive · top 15,000 on PyPI
django-encrypted-model-fieldsWraps Django model fields with transparent…
permissive · top 15,000 on PyPI
django-cryptography-5Provides encrypted model fields and…
permissive · top 15,000 on PyPI
cryptographycryptography provides cryptographic recipes and…
permissive · top 100 on PyPI
django-fernet-fields-v2Provides Fernet symmetric encryption for Django…
permissive · top 5,000 on PyPI
noiseprotocolImplements the Noise Protocol Framework for…
permissive · top 15,000 on PyPI
djfernetProvides Fernet symmetric encryption for Django…
permissive · top 15,000 on PyPI
fernetA pure Python implementation of the Fernet…
permissive · top 15,000 on PyPI
django-fernet-encrypted-fieldsProvides Django model fields that encrypt data…
unclear · top 15,000 on PyPI
pqcryptoProvides Python bindings to post-quantum…
permissive · top 15,000 on PyPI