Skip to content

Heshmatkhah/django-glrm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Global Login Required Middleware Doc_Badge

Django Global Login Required Middleware (django-glrm) is a Django middleware that make all views and URLs login required.

It's common in Django that most of the site's pages are protected, with just a few exceptions of pages that remain public (e.g. login page, etc.). It can be quite tedious to decorate all of the views with @login_required, and it can be easy to forget to decorate some of them.

So, you can use Django Global Login Required Middleware to make all page login required except some of them.

Note

Django 5.1+ Alternative: Starting with Django 5.1, you can use the built-in LoginRequiredMiddleware which provides similar functionality. See the Django documentation for more details.

Documentation is available at Read The Docs.

Quick start

  1. Install Django Global Login Required Middleware:

    $ pip install django-glrm
    
  2. Add "global_login_required.GlobalLoginRequiredMiddleware" to your MIDDLEWARE setting like this:

    MIDDLEWARE = [
        ...
        'global_login_required.GlobalLoginRequiredMiddleware',
    ]
    

3. Start the development server and visit http://127.0.0.1:8000/, now all your pages are login required and you will see the login page.

About

A Django middleware that make all views and URLs login required.

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages