Skip to main content

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, .env setups, and docker-compose.yml for 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:

  1. Standard django-admin startproject setup.
  2. Custom settings/URLs rendering via Jinja templates to suit your database/flavor choices.
  3. Creation of .env.example, .gitignore, Dockerfile, and docker-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:

  1. Selectors (selectors.py): Contains pure database query functions. They return QuerySets or dictionaries/objects and do not mutate state.
  2. Services (services.py): Contains business logic and mutators (creating, updating, deleting database records). Wrapped in @transaction.atomic to ensure transactional integrity.
  3. APIs (apis.py / views.py): Translates requests, triggers services or selectors, and serializes responses. Keep them light.
  4. 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

dj_scaffold_imhotep-1.0.2.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

dj_scaffold_imhotep-1.0.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file dj_scaffold_imhotep-1.0.2.tar.gz.

File metadata

  • Download URL: dj_scaffold_imhotep-1.0.2.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dj_scaffold_imhotep-1.0.2.tar.gz
Algorithm Hash digest
SHA256 6b35eedbe618152937d6dffc95531bad609897a403f942347d1bcdb5c7bb36b7
MD5 ac88f85cbd7774e317a451225d758225
BLAKE2b-256 c245141193e642e380eaf2c96498717c510fdeb27c16befa69ecad207f71a628

See more details on using hashes here.

Provenance

The following attestation bundles were made for dj_scaffold_imhotep-1.0.2.tar.gz:

Publisher: publish-pypi.yml on Imhotep-Tech/dj-scaffold

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dj_scaffold_imhotep-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for dj_scaffold_imhotep-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a6b844e61980fd76c7b0dd2daa9619fad6543b8cdd6b964023ee5c7b6b6a2de
MD5 0a8e8e3a9b64910849a8778fdae50753
BLAKE2b-256 9d0e8ebc69550cc34a79d61d1e1bbeee3efea1a24c8158d8b408b187a80957a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for dj_scaffold_imhotep-1.0.2-py3-none-any.whl:

Publisher: publish-pypi.yml on Imhotep-Tech/dj-scaffold

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.1.0

2 files

1.0.11

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

This release

1.0.2 This release

2 files

1.0.1

2 files

1.0.0

2 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