Opened 2 weeks ago

Closed 2 weeks ago

Last modified 2 weeks ago

#36444 closed New feature (wontfix)

Create Custom Django Management Command for Project + App Setup

Reported by: Lothar Tjipueja Owned by: Lothar Tjipueja
Component: Core (Management commands) Version: 5.1
Severity: Normal Keywords: command-line, startproject, startapp
Cc: Lothar Tjipueja Triage Stage: Unreviewed
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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

Change History (4)

comment:1 by Lothar Tjipueja, 2 weeks ago

Component: InternationalizationCore (Management commands)
Summary: Ticket: Create Custom Django Management Command for Project + App SetupCreate Custom Django Management Command for Project + App Setup

comment:2 by Lothar Tjipueja, 2 weeks ago

Needs documentation: set

comment:3 by Sarah Boyce, 2 weeks ago

Resolution: wontfix
Status: assignedclosed

Thank you for your suggestion! When suggesting a new feature for Django, the feature idea should first be proposed and discussed with the community. To do that, please raise this on the new feature tracker.

I'll close the ticket for now, but if the community agrees with the proposal, please return to this ticket and reference the forum discussion so we can re-open it. For more information, please refer to the documented guidelines for requesting features.

comment:4 by Natalia Bidart, 2 weeks ago

For further reference, this new feature request is currently being discussed and proposed via various channels. Reference links:

Note: See TracTickets for help on using tickets.
Back to Top