Skip to main content

A Django management command that scaffolds apps using packages instead of single-file modules

Project description

django-modular-startapp

A Django management command that replaces startapp with a package-based scaffold — replacing single-file modules like models.py, views.py, and tests.py with proper packages (models/, views/, tests/, etc.).

Why

Django's built-in startapp creates flat single-file modules. As apps grow, splitting models.py into models/ and views.py into views/ becomes necessary anyway. This command starts you off with that structure from the beginning.

Installation

pip install django-modular-startapp

Add to INSTALLED_APPS in your settings:

INSTALLED_APPS = [
    ...
    "django_modular_startapp",
]

Usage

python manage.py modular_startapp <app_name>

To create the app in a specific directory:

python manage.py modular_startapp <app_name> --directory path/to/dir

Generated Structure

<app_name>/
├── __init__.py
├── apps.py
├── urls.py
├── migrations/
│   └── __init__.py
├── admin/
│   └── __init__.py       # stub with admin.site.register example
├── models/
│   └── __init__.py       # stub with import hints
├── views/
│   └── __init__.py       # stub with import hints
└── tests/
    └── __init__.py       # stub with import hints

Notes

  • models/ — Add a file per model (e.g. user.py) and re-export from __init__.py so Django's migration system can discover them.
  • admin/ — One file per registered model keeps admin configuration readable.
  • views/ — Split by view type or resource (e.g. list.py, detail.py).
  • tests/ — One file per area under test (e.g. test_models.py, test_views.py).

Requirements

  • Python 3.12+
  • Django 4.2+

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_modular_startapp-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

django_modular_startapp-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file django_modular_startapp-0.1.0.tar.gz.

File metadata

  • Download URL: django_modular_startapp-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for django_modular_startapp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a017828a57ad58a346a59f279c6687e575b1006aed18565108ab6e1e41d14559
MD5 07bcad4948b25f2d98c642d3dc3c29bb
BLAKE2b-256 0cd9a6cdc313f559c9a7e93fd9495fcac36c02a16c592c65afab9326777e609d

See more details on using hashes here.

File details

Details for the file django_modular_startapp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_modular_startapp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afbcbc8d0b37dbaaf8f3d426397935a8ba36cdca692cb348d75bab68f519abd7
MD5 edeed37d6fd1b69e2ff4cb7e08d2f3d3
BLAKE2b-256 d8623bd7f49b97a2dbca51ebcef7dec853219b2524f5c741e0a6de4bb844a34a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page