Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Django authentication based based on HTTP basic authentication

Project Description


This module provides the client side for a HTTP Basic Authentication provider to allow authentication for a Django application. It must be installed as a Django authentication backend.

This allows to authenticate your Django application with the help of a web server that already provides HTTP Basic Authentication, as it is described in [RFC2617]( Web servers, such as Apache or Nginx, can easily be configured to adapt complex authentication scenarios, e.g. authentication via a combination of LDAP and manual filters. Your Django project is now able to utilize such a configuration.


Add this module to your and/or to requirements.txt file:

# … django-auth-http-basic # …

You need at least Django >= 1.10.


In your file, you must add/set the variable AUTHENTICATION_BACKENDS so that it includes the authentication backend, e.g.:

AUTHENTICATION_BACKENDS = [‘django_auth_http_basic.HttpBasicAuthBackend’]

In addition, you must specify an URL that provides HTTP Basic Authentication by providing a value for the variable HTTP_BASIC_AUTH_URL in your file, e.g.:


As long as the web services conforms to HTTP Basic Authentication, it could be used as an authentication backend. Since HTTP Basic Authentication transports user name and password in clear text, you should access it via HTTPS. If the web server is on your local host, you might use unencrypted HTTP.

The web server is expected to return a 401 response, if no user name and/or no password is provided. It must return a 2xx response if the user is authenticated, and a 403 response if the user is not authenticated. Currently, every response code except 2xx will be interpreted as a failed authentication. Most web servers conform to this rule. However, you are free to implement your own authenticating web server.

For testing purposes, HTTP_BASIC_AUTH_URL can be set to None. In this case no web server will be contacted, every user will be authenticated. Please be sure to change HTTP_BASIC_AUTH_URL to a valid URL for production code.

If you don’t set the variable HTTP_BASIC_AUTH_URL to any value, no user will be authenticated. In this case, an error message will be sent to the logger named django-auth-http-basic.

Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(4.5 kB) Copy SHA256 Hash SHA256
Source None Aug 27, 2017

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers