Skip to main content

WeFa Django Toolkit

WeFa (Web Factory) delivers a set of modular Django apps that cover recurring web platform concerns such as authentication bootstrapping and legal consent management. The toolkit focuses on convention-over-configuration so new projects can enable production-grade defaults with minimal setup.

Table of Contents

Features

  • Shared utilities that power the higher-level apps (nside_wefa.common)
  • Plug-and-play Django REST Framework authentication configuration (token and JWT) (nside_wefa.authentication)
  • Legal consent tracking with automatic user onboarding and templated documents (nside_wefa.legal_consent)
  • Per-user locale persistence with a public discovery endpoint (nside_wefa.locale)
  • Append-only audit log with REST endpoints, model-registration UX, built-in event sources, and optional tamper-evident hash chain — built on django-auditlog (nside_wefa.audit)
  • System checks and sensible defaults so configuration mistakes surface early

Installation

Install the package from PyPI:

pip install nside-wefa

Or add it to your dependency file (e.g. requirements.txt):

nside-wefa>=0.3.0

Included Apps

Common

Foundational helpers shared across the toolkit. You rarely interact with it directly, but it must be installed before the other apps.

Authentication

Automatically wires Django REST Framework authentication classes, URLs, and dependency checks. See nside_wefa/authentication/README.md for the full guide.

Tracks acceptance of privacy and terms documents with templating support and REST endpoints. See nside_wefa/legal_consent/README.md for details.

Locale

Persists each user's preferred locale and exposes the supported locales for the project over REST. See nside_wefa/locale/README.md for details.

Audit

Wraps django-auditlog to give every product an append-only audit store with four ergonomic ways to register models, REST endpoints (/audit/events/ for staff, /audit/me/ for end users), built-in event sources for auth / legal_consent / locale, an optional SHA-256 tamper-evident chain, and management commands for purge / verify / GDPR export. See nside_wefa/audit/README.md for details.

Quick Start

  1. Install the package.

  2. Add the apps to INSTALLED_APPS (order matters):

    INSTALLED_APPS = [
        # Django + DRF dependencies...
        "rest_framework",
        "rest_framework.authtoken",  # For token auth
        "rest_framework_simplejwt",  # For JWT auth
        "auditlog",  # Required by nside_wefa.audit
        "nside_wefa.common",
        "nside_wefa.authentication",
        "nside_wefa.legal_consent",
        "nside_wefa.locale",
        "nside_wefa.audit",
    ]
    
  3. Apply migrations:

    python manage.py migrate
    
  4. Expose the URLs you need:

    from django.urls import include, path
    
    urlpatterns = [
        # ...your URLs
        path("auth/", include("nside_wefa.authentication.urls")),
        path("legal-consent/", include("nside_wefa.legal_consent.urls")),
        path("locale/", include("nside_wefa.locale.urls")),
        path("audit/", include("nside_wefa.audit.urls")),
    ]
    

Configuration

The toolkit reads from a namespaced settings dictionary. Start with the minimal configuration below and extend it as needed:

# settings.py
NSIDE_WEFA = {
    "APP_NAME": "My Product",  # Used in legal consent templates
    "AUTHENTICATION": {
        "TYPES": ["TOKEN", "JWT"],  # Enable the authentication flows you need
    },
    "LEGAL_CONSENT": {
        "VERSION": 1,
        "EXPIRY_LIMIT": 365,  # days
        # "TEMPLATES": BASE_DIR / "templates/legal_consent",  # Optional overrides
    },
    "LOCALE": {
        "AVAILABLE": ["en", "fr"],
        "DEFAULT": "en",
    },
    "AUDIT": {
        # All keys are optional. See nside_wefa/audit/README.md.
        # Track third-party models you can't edit:
        # "MODELS": {"auth.Group": {"include_fields": ["name"]}},
        # "TAMPER_EVIDENT": True,   # SHA-256 hash chain (opt-in)
        # "RETENTION_DAYS": 365,    # used by wefa_audit_purge
    },
}

Validation happens through Django system checks. Run python manage.py check to surface configuration issues early.

Requirements

  • Python >= 3.12
  • Django >= 6.0.7
  • Django REST Framework >= 3.14.0
  • djangorestframework-simplejwt >= 5.5.1 (if you enable JWT support)

Local Development

Clone the repository and install the development extras:

cd django
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]

Run the demo project:

python manage.py migrate
python manage.py runserver

Execute the test suite and linters:

pytest

Contributing

We welcome feature ideas, bug reports, and pull requests. Check CONTRIBUTE for the current workflow (it will be merged with the repo-wide guidelines soon). Please include documentation updates and tests when relevant.

Metadata

Release files for nside-wefa 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nside-wefa 0.7.1
File Size Uploaded Provenance Actions
nside_wefa-0.7.1.tar.gz 154.6 kB With provenance Details for nside_wefa-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nside-wefa 0.7.1
File Interpreter ABI Platform Actions
nside_wefa-0.7.1-py3-none-any.whl Python 3 none any Details for nside_wefa-0.7.1-py3-none-any.whl

Total release size: 287.2 kB

Release files / nside_wefa-0.7.1.tar.gz

Download URL nside_wefa-0.7.1.tar.gz
Size 154.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4a83edb09da181f2803e859f2a6dd9d42a77e8fd7db202e6bd2791bee72b084a
BLAKE2b-256 checksum
How to use checksums
a72c64cc86b544ee4a72974579791dd33c1f87fa43b7ed5f48ecfa29cdfd7c42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / nside_wefa-0.7.1-py3-none-any.whl

Download URL nside_wefa-0.7.1-py3-none-any.whl
Size 132.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2661ee66d0c2d82eb7adf49c14061115128bce82f8e598811f81c122fee0d5c2
BLAKE2b-256 checksum
How to use checksums
3b37cd10b790295a16814cdd2d61f3a520d030e1b5a6a9797fece83a1fa71393
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Security for nside-wefa 0.7.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nside_wefa-0.7.1.tar.gz

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 Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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