Skip to main content

Dirty and insecure django pluggable to password-protect an entire website -- for instance, while under construction

Project description

Django-Doorkeeper

Django-Doorkeeper is a pluggable Django middleware that forces every visitor to a site to enter a password before viewing any pages. The password is the same for every user. Doorkeeper status is stored in a cookie and does not need to be re-entered on subsequent pageviews.

Doorkeeper IS NOT SECURE and should not be used for security purposes. Its intent is to protect a site from casual lookie-loos and stray bots. Under some circumstances you might do this with .htaccess and HTTP Basic Auth if your site is fronted with Nginx / Apache / etc. When it's not, this is a simple substitute.

Individual views can be exempted from the password prompt. See configuration documentation for more information.

Installation

pip install django-doorkeeper

Then configure as documented.

Configuration

See configuration documentation.

Demo App

This repository includes a demo application to showcase Doorkeeper's functionality. To run the demo:

  1. Navigate to the example directory:

    cd example
    
  2. Install Django and doorkeeper:

    pip install django
    pip install django-doorkeeper
    
  3. Run migrations and start the demo server:

    python manage.py migrate
    python manage.py runserver
    
  4. Visit http://127.0.0.1:8000/ in your browser. You'll be prompted for the password (default: "demo_password").

  5. To see a page that bypasses Doorkeeper, visit http://127.0.0.1:8000/public/

Testing

python runtests.py

Compatibility

Doorkeeper has been tested with Python 3.13 and Django 5.1 but will almost certainly work on many earlier and later versions. Maybe if anyone every uses this, someday I'll get around to adding Tox and a test matrix.

Project details


Download files

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

Source Distribution

django_doorkeeper-1.0.7.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file django_doorkeeper-1.0.7.tar.gz.

File metadata

  • Download URL: django_doorkeeper-1.0.7.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for django_doorkeeper-1.0.7.tar.gz
Algorithm Hash digest
SHA256 83564d18e14b81c7522cd28aee0915228aacfca7690a344b7f45c3f2b6986793
MD5 84be43b53307485c45c4fe737e6b4539
BLAKE2b-256 8ff166a1088750f08c5dd3d1ffd09c290d409b73a576c39846b4e581c1bbff7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page