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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9dc60647f8fefa131f772bd4306168b3b636bf0d68ff08cc814c7b1803aa569 |
|
MD5 | c34847f6223c375bd5c4ae5204e29628 |
|
BLAKE2b-256 | ad7daea5da0b37ef670785ee7544084d5ee06dc6cef843808eb37430768d2e45 |
Hashes for django_login_required_middleware-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3b77eb230055403de9a81d320cd35ed12216a413cc187ede7b02e3dbe2b4668 |
|
MD5 | e5f795c6819777eceaf02c93f8cd4e4f |
|
BLAKE2b-256 | 25f7cc9b5f703d11192a87354665440f54a8431a824924fc7382d73fac689f72 |