Installation

  • Download and install last version of Django Admin Two-Factor Authentication:

$ pip install django-admin-two-factor

Setup

  • Add admin_two_factor application to the INSTALLED_APPS setting of your Django project settings.py file (note it should be before django.contrib.admin):

INSTALLED_APPS = (
    'admin_two_factor.apps.TwoStepVerificationConfig',
    'django.contrib.admin',
    ...
)
  • Migrate admin_two_factor:

$ python manage.py migrate admin_two_factor
# or
$ python manage.py syncdb
  • Add ‍‍‍‍ADMIN_TWO_FACTOR_NAME in your settings.py. This value will be displayed in Google Authenticator.

ADMIN_TWO_FACTOR_NAME = 'PROJECT_NAME'
  • Include the Admin Two Factor URL config in PROJECT_CORE/urls.py:

urlpatterns = [
    path('admin/', admin.site.urls),
    path('two_factor/', include(('admin_two_factor.urls', 'admin_two_factor'), namespace='two_factor')),
    ...
]
  • Collect static if you are in production environment:

$ python manage.py collectstatic
  • Clear your browser cache