REST Multi-factor authentication package for Django
Project description
E-mail
SMS / text
3rd party mobile apps
Features
Easily pluggable and compatible with django-rest-framework
Allows user to pick an additional authentication method from range of backends defined by a developer. Read more: backends
Comes out of a box with email, SMS, mobile apps and YubiKey support
Supported versions
Python 3.8, 3.9, 3.10
Django 3.0, 3.1, 3.2, 4.0, 4.1
Django REST Framework 3.10, 3.11, 3.12, 3.13, 3.14
djangorestframework-simplejwt >= 4.3.0
Quick Start
Install the package using pip:
pip install django-trench
or add it to your requirements file.
Add trench library to INSTALLED_APPS in your app settings file:
INSTALLED_APPS = (
...,
'rest_framework',
'rest_framework.authtoken', # In case of implementing Token Based Authentication
...,
'trench',
)
Run migrations
Translation
Trench uses Transifex service to translate our package into other languages.
We will appreciate your help with translation.
https://www.transifex.com/merixstudio/django-trench/dashboard/
Local development
Clone the repo.
Crete virtual environment named e.g.
.venv:virtualenv .venvActivate the virtual environment:
source .venv/bin/activateInstall dependencies:
pip install black mypy pip install -r testproject/requirements.txtSet environment variables:
export PYTHONPATH=./testproject export DJANGO_SETTINGS_MODULE=settings export SECRET_KEY=YOURsecretGOEShereCreate a symbolic link to the
trench/module inside thetestproject/directory to emulate thetrenchpackage being installed.# make sure you run this command from the root directory of this project ln -s $(pwd)/trench/ $(pwd)/testproject/trenchCheck whether the tests are passing:
pytest --cov=testproject/trench testproject/tests/
Remember - anytime you change something in the django-trench source code you need to re-build and re-install
the package (steps 6-7) for the changes to be present during e.g. running the tests.
- [OPTIONAL] To make the tests run faster you can try to execute them in parallel.
To do so you need to install the
pytest-xdistpackage and run the tests with additional parameter of-n 8where8stands for the number of threads that will be spawned for executing the tests. Depending on the machine you’re using using this tool can speed up the test execution process up to 5 times.pytest -n 8 --cov=testproject/trench testproject/tests/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_trench_reboot-0.3.2.tar.gz
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | 4225ec8be07226961642b0fb40638a3f38ae2bf0a2a3d5ce82de1a4e5acec324 |
|
| MD5 | 05c28c9e011827f1616df9f3b1c496a0 |
|
| BLAKE2b-256 | 05d653fe59bb556efe724a9c17e5b126f604f4529bb5236c07112e3bfd1aef1c |
Hashes for django_trench_reboot-0.3.2-py3-none-any.whl
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 | b01c884234d316976d81f7c4767c88203459190039738dbdd44f0f3ddcea7087 |
|
| MD5 | 9016689ef92a1136e6802e2233b117d8 |
|
| BLAKE2b-256 | 90d05d9d5d36e3b17d1bf16fca9c8e7ed2c336bcc401de206f4fd67ef8d7a999 |