# hacksoftware/django-styleguide

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/hacksoftware-django-styleguide).**

6,209 stars · 615 forks · Python · MIT

## Links

- GitHub: https://github.com/HackSoftware/Django-Styleguide
- awesome-repositories: https://awesome-repositories.com/repository/hacksoftware-django-styleguide.md

## Description

This project provides architectural standards and patterns for organizing Django applications. It defines a project architecture guide focused on decoupling business logic from views and models through a service-layer architecture.

The guide establishes specific design patterns, including a service layer for standalone business logic functions and a data selector pattern for isolating complex database queries. It defines a standard for single-purpose views that delegate logic to services and utilize dedicated serializers for data input and output.

The framework covers several broader capability areas, including modular configuration management to separate environment overrides from base settings, a custom exception hierarchy for domain-driven error mapping, and a system for coordinating background tasks and periodic scheduling. It also includes standards for combining database constraints with model and service-level validation.

## Tags

### Software Engineering & Architecture

- [Application Architecture Guides](https://awesome-repositories.com/f/software-engineering-architecture/application-architecture-guides.md) — Defines a complete architectural standard for Django applications focused on decoupling logic through service layers.
- [Service Layers](https://awesome-repositories.com/f/software-engineering-architecture/core-business-logic/service-layers.md) — Implements a service layer to encapsulate business rules and database writes, decoupling them from views and models.
- [API Design Standards](https://awesome-repositories.com/f/software-engineering-architecture/coding-best-practices/engineering-best-practices/api-design-standards.md) — Provides standards for resource-oriented API design using single-purpose views and dedicated serializers.
- [Data Selectors](https://awesome-repositories.com/f/software-engineering-architecture/data-selectors.md) — Implements specialized selector functions for handling complex database queries to keep the API layer clean. ([source](https://github.com/hacksoftware/django-styleguide#readme))
- [Service-Layer Architectures](https://awesome-repositories.com/f/software-engineering-architecture/service-layer-architectures.md) — Provides a comprehensive architectural guide for organizing Django applications using a service layer and data selectors.
- [Selector-Based Data Access](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/layering-presentation/application-layer-architectures/state-management-architectures/selector-based-data-access.md) — Utilizes a selector-based data access pattern to isolate complex database queries from business logic.
- [Service Layer Patterns](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/modular-decoupled-design/structural-design-paradigms/decoupled-logic-encapsulation/logic-decoupling/service-layer-patterns.md) — Decouples business logic from views and models using standalone service functions.
- [Service-Triggering Workers](https://awesome-repositories.com/f/software-engineering-architecture/background-worker-orchestration/service-triggering-workers.md) — Treats asynchronous background tasks as thin triggers that delegate all actual execution to the core service layer.
- [Configuration Directories](https://awesome-repositories.com/f/software-engineering-architecture/directory-based-organization/configuration-directories.md) — Organizes project configuration into a modular directory to separate base defaults from environment-specific overrides.
- [Domain Error Mapping](https://awesome-repositories.com/f/software-engineering-architecture/domain-error-mapping.md) — Implements a custom exception hierarchy to map framework errors to consistent domain-specific responses.
- [Exception Hierarchies](https://awesome-repositories.com/f/software-engineering-architecture/error-handling/exception-logic-structures/exception-hierarchies.md) — Implements a custom exception hierarchy and global handlers to map framework errors to domain-specific responses. ([source](https://github.com/hacksoftware/django-styleguide#readme))
- [Background Task Schedulers](https://awesome-repositories.com/f/software-engineering-architecture/execution-control/background-task-schedulers.md) — Coordinates background tasks by using asynchronous workers to trigger business logic within the service layer. ([source](https://github.com/hacksoftware/django-styleguide#readme))
- [Modular Settings Directories](https://awesome-repositories.com/f/software-engineering-architecture/runtime-configuration-overrides/layer-based-configuration-overrides/configuration-sets/modular-settings-directories.md) — Provides a modular directory structure to separate base Django settings from environment-specific overrides.

### Data & Databases

- [Domain Logic Patterns](https://awesome-repositories.com/f/data-databases/object-relational-mappers/domain-models/logic-validation/domain-logic-patterns.md) — Provides standards for organizing business logic by separating data writing services from data retrieval selectors.
- [Service-Selector Separation](https://awesome-repositories.com/f/data-databases/object-relational-mappers/domain-models/logic-validation/domain-logic-patterns/service-selector-separation.md) — Employs a structural pattern that separates data writing services from data fetching selectors to isolate business rules. ([source](https://github.com/hacksoftware/django-styleguide#readme))
- [Data Selectors](https://awesome-repositories.com/f/data-databases/query-optimization-patterns/query-generation-patterns/data-selectors.md) — Implements a data selector pattern to isolate complex database queries from the API and service layers.
- [Multi-Layer Data Validation](https://awesome-repositories.com/f/data-databases/multi-layer-data-validation.md) — Combines database constraints with model and service-level validation to ensure comprehensive data integrity. ([source](https://github.com/hacksoftware/django-styleguide#readme))

### Web Development

- [API View Controllers](https://awesome-repositories.com/f/web-development/api-view-controllers.md) — Implements a pattern for structured API views that delegate business logic to services and use dedicated serializers. ([source](https://github.com/hacksoftware/django-styleguide#readme))
- [RESTful API Designs](https://awesome-repositories.com/f/web-development/restful-api-designs.md) — Defines architectural patterns for building structured REST APIs using dedicated serializers and thin views.
- [Logic Delegation Handlers](https://awesome-repositories.com/f/web-development/server-side-frameworks/kotlin-frameworks/coroutine-frameworks/asynchronous-route-mapping/logic-delegation-handlers.md) — Structures API views to handle only request routing and response formatting while delegating business logic to services.
- [Exception Response Mapping](https://awesome-repositories.com/f/web-development/backend-development/web-frameworks/routing-request-handling/error-route-handling/exception-response-mapping.md) — Provides a mechanism to map framework-level exceptions to a custom domain hierarchy for consistent API responses.
- [Django Project Configurations](https://awesome-repositories.com/f/web-development/django-integrations/django-project-configurations.md) — Structures project settings into modular directories to separate base configurations from environment-specific overrides.

### Part of an Awesome List

- [Service-Centric Background Tasking](https://awesome-repositories.com/f/awesome-lists/devtools/python-and-django-boilerplates/service-centric-background-tasking.md) — Implements asynchronous workers and periodic jobs as thin interfaces that trigger centralized service layer functions.

### Development Tools & Productivity

- [Environment Configuration Modules](https://awesome-repositories.com/f/development-tools-productivity/project-configuration/modular-feature-sets/environment-configuration-modules.md) — Provides a system for organizing project settings into a modular directory to separate environment overrides from base configurations. ([source](https://github.com/hacksoftware/django-styleguide#readme))

### DevOps & Infrastructure

- [Recurring Job Scheduling](https://awesome-repositories.com/f/devops-infrastructure/recurring-job-scheduling.md) — Provides a centralized command system for scheduling recurring jobs to ensure consistency of cron schedules. ([source](https://github.com/hacksoftware/django-styleguide#readme))
