django-light-auth
Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
Install
pip3 install -U django-light-auth
Usage
Basic Usage
settings.py
INSTALLED_APPS = [
# ...
# 'django.contrib.auth',
'django_light_auth.apps.DjangoLightAuthConfig',
# ...
]
MIDDLEWARE = [
# ...
'django.contrib.sessions.middleware.SessionMiddleware',
# 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django_light_auth.LightAuthMiddleware'
# ...
]
# Session
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'
# django-light-auth
LIGHT_AUTH_VALIDATE_FUNC = 'your_app.auth.validate_func'
urls.py
from django.urls import path
from django_light_auth import LoginView, LogoutView
urlpatterns = [
# ...
path('login', LoginView.as_view(), name='login'),
path('logout', LogoutView.as_view(), name='logout'),
]
your_app/auth/validate_func.py
#
# example at django_light_auth.light_auth_validate_func
#
from typing import Dict, Any
from your_app.config import config
def light_auth_validate_func(data: Dict[str, Any]) -> bool:
if data.get('username', None) == config.Auth.username and data.get(
'password', None
) == config.Auth.password:
return True
return False
Custom Login View
your_login_view.py
from django_light_auth import LoginView as LoginViewAbs
class LoginView(LoginViewAbs):
template_name = 'your_app/login.html'
History
0.2.3 - 20251112
- Maintenance release
v0.2.2 - 20220809
- Compatible Django 4.1+
Release files for django-light-auth 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_light_auth-0.2.3.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_light_auth-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 kB
Release files / django_light_auth-0.2.3.tar.gz
| Download URL | django_light_auth-0.2.3.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55e516ce84aef4e895814189397a36bba8c516c9bd3b813b1bb0dac7e6ee2847
|
|
BLAKE2b-256 checksum How to use checksums |
617769969f92f47fd78a69c0d4137760bac2d0805ef7080806654f65c5750325
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2025.
Transparency logRelease files / django_light_auth-0.2.3-py3-none-any.whl
| Download URL | django_light_auth-0.2.3-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a2e06575fbf6bcbbe600cf211cf14929748c0f7fdf7d44e997b9d5e271c94d8
|
|
BLAKE2b-256 checksum How to use checksums |
e766556990ed508ff834c1a7ac88dfa56cd7121bd4cc15786b65a6e8bc193d54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2025.
Transparency log