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__.pyso 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
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_modular_startapp-0.1.1.tar.gz.
File metadata
- Download URL: django_modular_startapp-0.1.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7e7648ef21f0f1dd9bcfa6acbe0cb77d401b165b96e6c41a9f8746ada210fad
|
|
| MD5 |
194bc8d7e01af9ef9fb0bc057e0fb104
|
|
| BLAKE2b-256 |
e2aa348ae1c593ddadb213d898e471ede8dbc0206df9be7f692138ac57c0c85b
|
File details
Details for the file django_modular_startapp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_modular_startapp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc67eadc851c3b81fa6bee0c469e3aa1d249c6ef5780b1c8662a339c16d94b00
|
|
| MD5 |
dcce0496612eda67ee7fd20ce791d0a6
|
|
| BLAKE2b-256 |
a4be61885ae800e0f4748c2b18eae399024a4102aa5dd727f198e9fb8434597e
|