django-otp
A pluggable framework for adding two-factor authentication to Django using one-time passwords.
What it is and what it does
django-otp is a pluggable framework for adding one-time password authentication to Django projects. It integrates with Django's built-in authentication system to enable two-factor authentication without replacing the core auth backend. The package includes implementations of the standard HOTP and TOTP algorithms (RFC 4226 and RFC 6238) and supports a plugin architecture for additional OTP methods.
The project is stable and production-ready but is aging—it is no longer actively developed by its original author, though the repository remains open to well-formed contributions. It targets developers who need to add OTP-based two-factor authentication to existing Django applications. For users seeking a more opinionated, higher-level solution, the description notes that django-two-factor-auth may be a better fit.
Use it for:
- Add two-factor authentication to a Django admin interface or user login flow using TOTP codes from authenticator apps.
- Implement OTP-based account recovery or sensitive action verification in a Django web application.
- Build a custom authentication flow that requires both password and one-time code validation.
- Integrate hardware or software OTP generators into a Django-based identity management system.
- Extend Django authentication with pluggable OTP methods tailored to specific security requirements.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds one-time password (OTP) support to Django applications, enabling two-factor authentication through HOTP and TOTP algorithms integrated with Django's authentication system.
Yes, if you need OTP-based two-factor authentication in Django and can accept a stable but aging codebase. The package is production-ready, has no known vulnerabilities, and low install friction. However, the lack of active development means you should verify that any OTP plugins you need remain compatible with your Django version, and consider django-two-factor-auth if you prefer a more actively maintained, opinionated solution.
Install
django-otp on PyPI
pip
pip install django-otpuv
uv add django-otppoetry
poetry add django-otpInstalling django-otp
Before you install
Low install friction with a single runtime dependency on django. Maintenance status is aging—the project is stable and production-ready but no longer actively developed by its author, though well-formed issues and pull requests are welcomed.
License in practice
Licensed under the Unlicense (permissive), placing the code in the public domain with no restrictions on use, modification, or distribution.
Quickstart
pip install django-otp
from django_otp.decorators import otp_required
@otp_required
def my_view(request):
pass
Requires Django to be installed and configured; integrates with django.contrib.auth but is not itself an authentication backend.
Verify before relying
- Whether existing OTP plugins remain maintained and compatible with current Django versions.
- Performance characteristics when handling high volumes of OTP validation requests.
- Compatibility with modern authentication patterns beyond traditional two-factor flows.
Package facts
| License | Unlicense (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — django |
| Maintenance | aging — 219 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,148,580/month — #2,156 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_otp-1.7.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
django-allauth-2faAdds two-factor authentication to…
permissive · top 15,000 on PyPI
django-two-factor-authAdds complete two-factor authentication to…
permissive · top 5,000 on PyPI
PyOTPPyOTP generates and verifies one-time passwords…
permissive · top 1,000 on PyPI
yubico-clientVerifies Yubico One Time Passwords (OTPs) using…
permissive · top 15,000 on PyPI
django-otp-webauthnAdds WebAuthn Passkey support to Django OTP,…
permissive · top 15,000 on PyPI
oathtoolGenerates one-time passwords (TOTP codes) from…
permissive · top 15,000 on PyPI
authyPython client for the Twilio Authy two-factor…
permissive · top 15,000 on PyPI
pwned-passwords-djangoIntegrates password breach checking from the…
permissive · top 15,000 on PyPI
google-reauthProvides two-factor authentication reauth…
permissive · top 5,000 on PyPI
django-allauthProvides integrated local and social…
permissive · top 5,000 on PyPI