#36444: Ticket: Create Custom Django Management Command for Project + App Setup
-------------------------------------+-------------------------------------
Reporter: lothartj | Owner: lothartj
Type: New | Status: assigned
feature |
Component: | Version: 5.1
Internationalization | Keywords: command-line,
Severity: Normal | startproject, startapp
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The current workflow for starting a new Django project requires multiple
commands:
{{{
django-admin startproject myproject
cd myproject
python manage.py startapp myapp
}}}
Then manually adding the app to `INSTALLED_APPS`.
This patch adds a new `create` management command that combines these
steps into a single command:
{{{
django-admin create myproject myapp
}}}
Features:
* Creates both project and app in one command
* Automatically adds app to `INSTALLED_APPS`
* Maintains existing settings.py formatting
* Includes comprehensive test coverage
* Backwards compatible (existing commands remain unchanged)
Usage:
{{{
# Basic usage
django-admin create myproject myapp
# With optional directory
django-admin create myproject myapp --directory /path/to/directory
}}}
The command:
1. Creates a new project using `startproject`
2. Creates a new app using `startapp`
3. Automatically adds the app to `INSTALLED_APPS` in settings.py
4. Maintains proper indentation and quote style in settings.py
Test coverage includes:
* Basic project and app creation
* Directory handling
* Error cases
* Output messages
* INSTALLED_APPS formatting
Patch includes:
* New management command: `django/core/management/commands/create.py`
* Test suite: `django/tests/user_commands/tests.py`
--
Ticket URL: <https://code.djangoproject.com/ticket/36444>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070197452b50bc-1e2fb054-1401-445a-b66e-40f8e5d3af24-000000%40eu-central-1.amazonses.com.