Skip to main content

🛡️ 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.

Metadata

Release files for django-abstract 0.1.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-abstract 0.1.3
File Size Uploaded
django_abstract-0.1.3.tar.gz 49.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-abstract 0.1.3
File Interpreter ABI Platform
django_abstract-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 105.3 kB

Release files / django_abstract-0.1.3.tar.gz

Download URL django_abstract-0.1.3.tar.gz
Size 49.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d6146d74dc59fce0635cd34f382f2a4336f423b99c781e9f54811ad314897dfd
BLAKE2b-256 checksum
How to use checksums
519f3540113d8fc4fe1bb6afb100e06d9178b28dfc8f8d902c727430994986c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release files / django_abstract-0.1.3-py3-none-any.whl

Download URL django_abstract-0.1.3-py3-none-any.whl
Size 55.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f97f9a13eefb0778ae03d11c57c646b4ade928bccf60b82e2149acab0725a67e
BLAKE2b-256 checksum
How to use checksums
46f69b5bdfa92adf1ea0448f9499ce102a7fe1ca278046637be802df42288d4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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