Requires login to all requests through middleware.
Project description
django-login-required-middleware
django-login-required-middleware provide login to all requests through middleware.
If the website has many views and almost all use
LoginRequiredMixin
or the login_required
decorator, using django-login-required
can keep the code of your views more clear and avoids forgetting authentication of view.
Requirements
- Python: 3.6, 3.7
- Django: 1.11, 2.0, 2.1, 2.2
Quick start
-
Install
pip install django-login-required-middleware
-
Add
'login_required'
in yourINSTALLED_APPS
setting. -
Add
login_required.middleware.LoginRequiredMiddleware
toMIDDLEWARE
afterdjango.contrib.auth.middleware.AuthenticationMiddleware
-
(Optional) Add
LOGIN_REQUIRED_IGNORE_PATHS
setting.
Any requests which match these paths will be ignored. This setting should be a list filled with regex paths (settings.LOGIN_URL
always included).
Example:
LOGIN_REQUIRED_IGNORE_PATHS = [
r'accounts/logout/$'
r'accounts/signup/$',
r'about/$'
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-login-required-middleware-0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eb506ab507fc299d283e86f4d9893dbb55bffe73e6543bd7bc39ec9442ae6d1 |
|
MD5 | 77be64501dcd1adb027db4c2e3b11410 |
|
BLAKE2b-256 | c241dd31fada7dcb9e22b7f38360904b13768fd18749dd53a42e677212e524a2 |
Hashes for django_login_required_middleware-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ede542f4adf47338cfc13d1b18f39e71c1d38f94efdf30c924a36e7d2fa7442 |
|
MD5 | 943ba7edd61406ba38634b5de1405bc9 |
|
BLAKE2b-256 | f73ed7b799371583eb51cc54fb42c3ce57df5a7d4e10aa5e8a3042dccaf1ec36 |