dj-scaffold
A modern, interactive scaffolding CLI for Django projects, inspired by frontend tools like create-next-app. It helps developers set up containerized, production-ready Django applications and enforces a clean Service Layer Architecture for modular, testable django applications.
Features
- ✨ Interactive Prompts: Quick setup via terminal menus using arrow keys.
- 🐳 Dockerized by Default: Generate production-ready
Dockerfile,.envsetups, anddocker-compose.ymlfor PostgreSQL or MySQL. - 🛠️ API Flavors: Choose from Standard Django, Django REST Framework + Spectacular (OpenAPI 3.0), or Django Ninja.
- 🏗️ Service Layer Architecture: Scaffolding for app structure segregating HTTP API route handlers (
apis.py), Business Logic mutations (services.py), Database Queries (selectors.py), and Models (models.py).
Installation
The easiest way to install dj-scaffold is from PyPI:
pip install dj-scaffold-imhotep
(For local development: clone the repository and run pip install -e .)
Usage
Run dj-scaffold with no flags to open the interactive wizard. Use the arrow keys to move between choices and press Enter to confirm.
1. Creating a New Django Project
To create a new project, run:
dj-scaffold create
The CLI will prompt you for the project name, database engine, and API framework.
Commands run under the hood:
- Standard
django-admin startprojectsetup. - Custom settings/URLs rendering via Jinja templates to suit your database/flavor choices.
- Creation of
.env.example,.gitignore,Dockerfile, anddocker-compose.yml.
2. Creating a New Service App
To create a new app, run:
dj-scaffold startapp
The CLI will prompt you for the app name and architecture style.
Under the Service Layer selection, the following file structure is created:
your_app/
├── __init__.py
├── apps.py
├── models.py
├── apis.py
├── services.py
├── selectors.py
└── urls.py
Architecture: Why the Service Layer Pattern?
Standard Django often leads to bloated model methods (Fat Models) or complex views (Fat Views). The Service Layer Pattern enforces separation of concerns:
- Selectors (
selectors.py): Contains pure database query functions. They return QuerySets or dictionaries/objects and do not mutate state. - Services (
services.py): Contains business logic and mutators (creating, updating, deleting database records). Wrapped in@transaction.atomicto ensure transactional integrity. - APIs (
apis.py/views.py): Translates requests, triggers services or selectors, and serializes responses. Keep them light. - Models (
models.py): Pure schema definition and DB relationships, minimal or zero business logic.
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 dj_scaffold_imhotep-1.0.3.tar.gz.
File metadata
- Download URL: dj_scaffold_imhotep-1.0.3.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bfa8003dcb64b4e371b4dc72281950a3642b139a300307ef6cd3bcda86ac810
|
|
| MD5 |
dfcd9349b0a8e320669dd35e0d7bf8dc
|
|
| BLAKE2b-256 |
ccd7f9d93284b4f76052a788151b3aa72941277d6e93ad96e98cbc963fc1122d
|
Provenance
The following attestation bundles were made for dj_scaffold_imhotep-1.0.3.tar.gz:
Publisher:
publish-pypi.yml on Imhotep-Tech/dj-scaffold
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dj_scaffold_imhotep-1.0.3.tar.gz -
Subject digest:
3bfa8003dcb64b4e371b4dc72281950a3642b139a300307ef6cd3bcda86ac810 - Sigstore transparency entry: 2069917876
- Sigstore integration time:
-
Permalink:
Imhotep-Tech/dj-scaffold@e1ec467c727f03938e636d0bab6bc3c8bae74f1d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Imhotep-Tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e1ec467c727f03938e636d0bab6bc3c8bae74f1d -
Trigger Event:
push
-
Statement type:
File details
Details for the file dj_scaffold_imhotep-1.0.3-py3-none-any.whl.
File metadata
- Download URL: dj_scaffold_imhotep-1.0.3-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1329e95b0586996c1e7b328f6e3c8d4bd0c512a2fabfb6b89c372f74e8288a94
|
|
| MD5 |
eb13447523da229a9cda190a54692bf0
|
|
| BLAKE2b-256 |
98266cdfe3862b0fc028f7eb92326959cefe20c2ba3944e11b118688b60d4677
|
Provenance
The following attestation bundles were made for dj_scaffold_imhotep-1.0.3-py3-none-any.whl:
Publisher:
publish-pypi.yml on Imhotep-Tech/dj-scaffold
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dj_scaffold_imhotep-1.0.3-py3-none-any.whl -
Subject digest:
1329e95b0586996c1e7b328f6e3c8d4bd0c512a2fabfb6b89c372f74e8288a94 - Sigstore transparency entry: 2069917969
- Sigstore integration time:
-
Permalink:
Imhotep-Tech/dj-scaffold@e1ec467c727f03938e636d0bab6bc3c8bae74f1d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Imhotep-Tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e1ec467c727f03938e636d0bab6bc3c8bae74f1d -
Trigger Event:
push
-
Statement type: