REST Multi-factor authentication package for Django
SMS / text
3rd party mobile apps
Python 3.7, 3.8, 3.9
Django 2.0, 2.1, 2.2, 3.0
Django REST Framework 3.10
djangorestframework-simplejwt >= 4.3.0
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', )
Trench uses Transifex service to translate our package into other languages.
We will appreciate your help with translation.
Clone the repo.
Crete virtual environment named e.g.
Activate the virtual environment:
pip install black mypy pip install -r testproject/requirements.txt
Set environment variables:
export PYTHONPATH=./testproject export DJANGO_SETTINGS_MODULE=settings export SECRET_KEY=YOURsecretGOEShere
Create a symbolic link to the
trench/module inside the
testproject/directory to emulate the
trenchpackage being installed.
# make sure you run this command from the root directory of this project ln -s $(pwd)/trench/ $(pwd)/testproject/trench
Check 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
8stands 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/
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for django_trench-0.3.1-py3-none-any.whl