skillfed

django-otp

A pluggable framework for adding two-factor authentication to Django using one-time passwords.

django-otp v1.7.0 5.1M downloads/30d#2,156 on PyPI627
Permissive license Unlicense AGING released

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-otp

uv

uv add django-otp

poetry

poetry add django-otp

Installing 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

Development Status :: 5 - Production/StableFramework :: DjangoIntended Audience :: DevelopersLicense :: OSI Approved :: The Unlicense (Unlicense)Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: SecurityTopic :: Software Development :: Libraries :: Python Modules

Tags

django two-factor authenticationone-time password otp djangototp hotp implementationdjango 2fa frameworkotp plugins djangodjango authentication otptwo-factor auth django
two-factor-authotpdjango-framework

More Python Modules packages