Skip to main content

A django app, that ofers abstracted logic for Django.

Project description

🛡️ Django Abstract

An Enterprise-Grade Architectural Layer for Django

Clean Architecture | Dependency Injection | CQRS Principles | Domain-Driven Design


📖 Overview

Django Abstract is a highly advanced framework built on top of Django that strictly enforces Clean Architecture and Domain-Driven Design (DDD). It solves the infamous "Fat Model / Fat View" anti-pattern by completely decoupling:

  1. Data Access (Selectors / Creators)
  2. Business Logic (Services)
  3. Flow Control & Permissions (Operators / Systems)

This framework provides a unified, predictable way to scale complex Django applications, manage high-throughput operations via Redis queues, and dynamically inject dependencies.

🚀 Key Features

🧩 Global Registry & Dependency Injection

  • Dynamically registers all architectural components using decorators (@creator_selector, @register_service, @register_operator).
  • Injects BaseDependency instances at runtime to prevent circular imports and allow test mocking.
  • Magic attribute resolution (__getattr__) allows developers to resolve dependencies seamlessly (dependency.select_user).

🏛️ Strict Architectural Separation

  • BaseModel: Adds soft-delete, active toggles, and rich audit trails natively.
  • BaseSelector / BaseCreator: Isolates raw Django ORM calls from business logic.
  • BaseService: Pure business logic that operates exclusively on an abstract ServiceEntryData state.
  • BaseSystem: Orchestrates workflows and manages global database transactions (transaction.atomic()).

⚡ High-Throughput Background Logging

  • Includes a robust log/ app that tracks SystemErrorLog, SessionMetrics, and AdminActionLog.
  • Uses a Redis-backed queueing system within ModelServices to buffer high-frequency inserts and bulk-flush (bulk_create) them to PostgreSQL, completely preventing database locking during traffic spikes.

🔌 Seamless View Binding

  • Replaces traditional Django Views with EntryBindingMixin.
  • Automatically extracts session_key, ip_address, and POST/GET payloads, hydrates a master Entry object, and passes it directly to the orchestration Systems.

📁 Repository Structure

src/django_abstract/
├── base/        # Core architectural base classes
├── generic/     # Generic, reusable creation/selection patterns
├── log/         # High-performance asynchronous auditing system
├── registry.py  # Global Dependency Injection container
└── utilities.py # Context extraction, View Mixins, State Objects

📚 Documentation

Comprehensive documentation for every module can be found in the docs/ folder:

🧪 Testing

The repository is fully testable. Due to strict dependency injection, any Selector or Creator can be swapped out with a mock class during tests. Test stubs for all modules are located in the tests/ directory.

👨‍💻 Author

Designed and implemented as an enterprise architectural study to showcase advanced systems design, Python metaprogramming, and scalable Django architecture.

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

django_abstract-0.1.0.tar.gz (49.6 kB view details)

Uploaded Source

Built Distribution

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

django_abstract-0.1.0-py3-none-any.whl (55.5 kB view details)

Uploaded Python 3

File details

Details for the file django_abstract-0.1.0.tar.gz.

File metadata

  • Download URL: django_abstract-0.1.0.tar.gz
  • Upload date:
  • Size: 49.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for django_abstract-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1098ef2e0fe04ac912097ed85b7dd587c70e439f5ccb72bf267f7f34e6d37c4c
MD5 1a643e49708b34053e2151a6a5446099
BLAKE2b-256 f48c5e5c2fa11727fb961e3d325527665d71d4302a8862401498e1db40de8d48

See more details on using hashes here.

File details

Details for the file django_abstract-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_abstract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65ae2ecb9fd23b4a33a9412f3f54bf7db9d83d9f594f4c8e020d9e09788619e0
MD5 12954ec54fcd3fd6e605dc0831d141a6
BLAKE2b-256 8edada4a5e6136cf9a42159d59b89b8553d92f2d810a0d7a5dd86a5509e81007

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