First steps

  1. Install the package using pip:
pip install django-trench

or add it to your requirements file.

  1. Add trench library to INSTALLED_APPS in your app settings file:
    'rest_framework.authtoken',  # In case of implementing Token Based Authentication


If you’re going to use djoser to handle user authentication make sure you have it installed and included in INSTALLED_APPS. You’ll also need djangorestframework-jwt to support JSON Web Tokens.


urlpatterns = [
    url(r'^auth/', include('trench.urls')),
If you utilise djoser and JWT authentication:
urlpatterns = [
    url(r'^auth/', include('trench.urls')), # Base endpoints
    url(r'^auth/', include('djoser.urls')),
    url(r'^auth/', include('trench.urls.djoser')),  # for Token Based Authorization
    url(r'^auth/', include('trench.urls.jwt')), # for JWT

django-trench supports djangorestframework built-in Token Based Authentication, as well as JSON Web Tokens. You’ll need setup it accordingly:
        # or / and
        # or / and


Last but not least, run migrations:
$ ./ migrate