Skip to main content

django-light-auth

PyPI - Version Python Version from PEP 621 TOML PyPI - Django Version PyPI - Downloads

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)

Source distribution for django-light-auth 0.2.3
File Size Uploaded
django_light_auth-0.2.3.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-light-auth 0.2.3
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page