A command-line tool to generate Django projects and apps following the hexagonal (ports and adapters) architecture.
Project description
Django Hexagonal Architecture
A command-line tool to generate Django projects and apps following the hexagonal (ports and adapters) architecture.
What is this?
django-hexagonal-cli is a CLI utility that helps you quickly scaffold Django projects and apps with a clean hexagonal structure, ready for scalable, maintainable, and testable development.
Installation
pip install django-hexagonal-cli
This will provide the django-admin-hex command.
Usage
-
Create a new project:
django-admin-hex startproject <project_name> [<first_app_name>]
This generates a Django project with the recommended hexagonal structure. Optionally, you can create the first app at the same time.
-
Create a new app in an existing project:
cd <project_name> django-admin-hex startapp <app_name>
This creates a new app inside the
apps/folder, following the hexagonal pattern.
Project Structure Example
project_root/
├── apps/
│ └── <app_name>/
│ ├── application/
│ ├── domain/
│ ├── infrastructure/
│ └── interfaces/
├── config/
├── manage.py
├── pyproject.toml
└── README.md
Why Hexagonal Architecture?
- Promotes separation of concerns
- Makes testing and maintenance easier
- Adapts easily to new frameworks or external services
Example
This repository includes a working example of a Django project with hexagonal architecture in the example/ folder. You can explore it to see a real API implementation using this structure.
Resources
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_hexagonal_cli-0.1.1.tar.gz.
File metadata
- Download URL: django_hexagonal_cli-0.1.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
559ae07c8e3cf26fa94e2372a22cffa4d8d3f510c1a8cd0fa13954bb2326dc24
|
|
| MD5 |
916d38e5f55e8a95ae1343395e1f4e9e
|
|
| BLAKE2b-256 |
af970ad35bef5a138b4b142c4f1100e372244b0705fe2a4f11a94fca2e7ac326
|
File details
Details for the file django_hexagonal_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_hexagonal_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0809a8fd85e0cd1e00a724418bd8cc03d4d88ca13c509e958299e89c37b0df83
|
|
| MD5 |
66360a01e77e484f36851f311c1cc9c2
|
|
| BLAKE2b-256 |
3dd6a91d85777ae4a9edcbba65dd5ac7ddbcbe2766dc9baed086061bafdd5d72
|