Skip to main content

Default configuration and components for Django projects.

Project description

Kition Django Defaults

This package provides default configuration and components for Django projects.

Motivation

Building, operating and maintaining many Django applications leads to repetitive code. This repository strives to reduce the mental overhead by providing code that otherwise would have to be repeated.

Installation

Requirements

Python 3.12 and Django 5.1 supported.

Installation

  1. Install with pip:
    python -m pip install kition-djangodefaults
    
  2. (Optional) configure any of the following components.

Default Configuration

Use the default settings by calling initialize_settings() after defining the DJANGO_SETTINGS_MODULE within manage.py and WSGI / ASGI.

Example

import os
import sys

from kition_djangodefaults import initialize_settings


def main():
    """Run administrative tasks."""
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
    initialize_settings()

    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)


if __name__ == "__main__":
    main()

Kubernetes Readiness Endpoint Middleware

Install via

MIDDLEWARE = [
    # Putting the healthcheck middleware first to circumvent ALLOWED_HOSTS protections, which would fail Kubernetes
    # Readiness Probe requests.
    "kition_django_defaults.healthcheck.HealthCheckMiddleware",
    ...
]

Development

poetry env use $(pyenv which python)
poetry install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kition_djangodefaults-0.2.0rc3.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kition_djangodefaults-0.2.0rc3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file kition_djangodefaults-0.2.0rc3.tar.gz.

File metadata

  • Download URL: kition_djangodefaults-0.2.0rc3.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.6 Darwin/23.6.0

File hashes

Hashes for kition_djangodefaults-0.2.0rc3.tar.gz
Algorithm Hash digest
SHA256 85d5be4eb2729e3a87610db52c279eea625828041e8cd5de7bfed748d6b2c9a9
MD5 b51c0c169d6bce30cdb6b94207ef7d5f
BLAKE2b-256 5bdfacbdf5f9b93aecaf012149850b9c20f5dff3e975d54f7ed361c1226378a4

See more details on using hashes here.

File details

Details for the file kition_djangodefaults-0.2.0rc3-py3-none-any.whl.

File metadata

File hashes

Hashes for kition_djangodefaults-0.2.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 0edc6fb5e986cd15d3910dd93a493baf7e7798ac6f9792cad34da480fbe23f58
MD5 eca415df355fe5461fea6ed69a9c201c
BLAKE2b-256 9845f86be984923f4444795e62cab8f0c20ff4bb2366a61791fb4129b63969c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page