restricted-paths

Restricts access to certain url paths based on environment.


Keywords
django, urls
License
BSD-1-Clause
Install
pip install restricted-paths==1.0.0

Documentation

Django Restricted Paths

Description

Restricts access to specific urls to staff only by responding with a specific view or raising a 404.

Installation

pip install django-restricted-paths

Usage

in settings.py:

RESTRICTED_PATHS = {
  "ENABLED": not DEBUG,
  "PATHS": ("/admin",),
  "VIEW": "path.to.view.class.ViewClass",
}

MIDDLEWARE = (
    ...
    "restricted_paths.middleware.RestrictedPathsMiddleware"
)