Django integration
Project description
kernia-django
Django integration for Kernia. Mounts the auth router, populates request.kernia_session and request.kernia_user, and provides a view decorator for protected views.
Part of Kernia, a framework-agnostic authentication library for Python.
Installation
pip install kernia-django
Usage
Add the app to INSTALLED_APPS and the middleware, then splice the auth routes into urls.py:
# urls.py
from django.urls import path
from kernia_django import setup
from myproject.auth import auth # your init(KerniaOptions(...)) instance
urlpatterns = [
*setup(auth, url_prefix="/api/auth"),
]
# views.py
from kernia_django import require_session
@require_session
def me(request):
return JsonResponse({"user_id": request.kernia_user["id"]})
Django is sync-by-default; the bridge uses asgiref.sync.async_to_sync to call the async core.
Documentation
Full documentation at kernia.dev/docs. Source at github.com/advantch/kernia.
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kernia_django-0.1.0.tar.gz.
File metadata
- Download URL: kernia_django-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fa449e2721ed32ae3e3760ef78d3f74c236ba64dc7100b1d646f19e540e11af
|
|
| MD5 |
edc66a28dfd9d6722a5bf6d89f6a3662
|
|
| BLAKE2b-256 |
2727100ed82c8f6cc076704f887e85e989a33e9b680e46a9f852786d19f7782c
|
File details
Details for the file kernia_django-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kernia_django-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de84a8165ce2af56fa3a8113c0f670c03dca60bec20b92a9bc720e306974896c
|
|
| MD5 |
b5ef6ca77599fea854ca0e2e479308aa
|
|
| BLAKE2b-256 |
99c54e13cf299a91538f1f5ace42f92a31e33425b2a55691b54d0e6ea5747ba6
|