Django Admin 2FA
Django Admin 2FA Plus is a secure, easy-to-use Two-Factor Authentication package for Django Admin. It provides TOTP-based verification (Google Authenticator, Authy, etc.), recovery codes, and optional trusted devices.
🚀 Key Features
🔐 Fortified Admin Security
- Two-Factor Authentication (2FA) for Django Admin
- Adds an extra layer of protection for staff logins
📲 Flexible TOTP Support
- Time-based One-Time Passwords using apps like:
- Google Authenticator
- Authy
- and more!
🛡️ Recovery & Backup
- One-time backup codes for account recovery
🧩 Device & Access Control
- Built-in admin panel to view & manage TOTP devices
- "Trusted Device" support — keeps your users happy with fewer prompts
🎨 Rate Limit
- Extra security with rate limit
⚙️ Compatibility
- Supports Django 3.2-5.* and above
- Easy to integrate with existing Django projects
📦 Installation
pip install django-admin-2fa
Add it to your INSTALLED_APPS:
INSTALLED_APPS = [
...
"djangoadmin2fa",
]
Include the URLs:
# urls.py
path("admin2fa/", include("djangoadmin2fa.urls")),
Add SITE_NAME variable in your django setting (Recomended) Otherwise default DJANGO ADMIN 2FA will be shown in your authenticator app and in backup code print page instead of your website name.
#settings.py
SITE_NAME = "www.yoursite.com"
Add the middleware near the top of your middleware stack:
MIDDLEWARE = [
...
"djangoadmin2fa.middleware.Admin2FAMiddleware",
"djangoadmin2fa.middleware.Admin2faRateLimitMiddleware",
]
Run migrations:
python manage.py migrate
🚀 Quick Start
- Log in to Django Admin.
- It will automatically return to 2FA Setup page.
- Scan the QR code using your authenticator app.
- Enter the generated code to confirm.
- Copy/Print the backup codes displayed — each can be used once.
- Done! (Logout and login again to see effect)
🤝 Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Create your feature branch:
git checkout -b feature/my-feature - Commit your changes:
git commit -am 'Add new feature' - Update code, if needed, as per pre-commit logs
- Push to the branch:
git push origin feature/my-feature - Open a Pull Request
You must follow PEP8, isort and must have proper test cases.
📬 Support
For questions, bug reports, or feature requests, please open an issue on GitHub. Feel free to reach out via email: python.package@himosoft.com.bd
📄 License
This project is licensed under the MIT License. See the LICENSE file for details. 🚫 Branding usage is restricted — see the LICENSE and TRADEMARK files for details.
Secure your Django Admin with TOTP based 2FA system ✨
Metadata
Release files for django-admin-2fa 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_admin_2fa-1.0.0.tar.gz | 17.5 kB | Without provenance | Details for django_admin_2fa-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_admin_2fa-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for django_admin_2fa-1.0.0-py3-none-any.whl |
Total release size: 44.7 kB
Release files / django_admin_2fa-1.0.0.tar.gz
| Download URL | django_admin_2fa-1.0.0.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6cced99d357b5dc945d99b9aa9604e629745a09e98807d5b3e82d2ade4602b19
|
|
BLAKE2b-256 checksum How to use checksums |
bb16b2227804d1ed208564466fbc59487a6ca8cf431afe3ca55c04dc5cc217ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / django_admin_2fa-1.0.0-py3-none-any.whl
| Download URL | django_admin_2fa-1.0.0-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a1887491dcf70eed3c58e1f78d9a708de7dd52800ee5d9f23394d937c740c7f
|
|
BLAKE2b-256 checksum How to use checksums |
32f05a8313e572c2a93ba5d1312108a501188179eb46ec334a58db7709f777fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for django-admin-2fa 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.