Skip to main content

django-new โœจ

Create new Django applications with pizazz. ๐Ÿš€

Features ๐Ÿš€

  • Interactive mode for creating new applications.
  • Predefined structure for typical use cases:
    • API
    • data
    • website
    • worker
  • Create new Django applications based on a starter template.
  • Create "minimal" projects (aka DEP-15) for a streamlined codebase.
  • When creating new apps, automatically add them to INSTALLED_APPS.
  • Create other files that are typically used in a Django project with sensible defaults:
    • .env - Environment variables
    • .gitignore - git ignore patterns
    • pyproject.toml - Python project configuration (PEP 621 compliant)
    • README.md - Project documentation

Goals ๐ŸŽฏ

  • Strike a balance between django-admin startproject / django-admin startapp and more full-fledged starter projects.
  • Have some opinions about the structure for different use cases, but try to avoid prescribing specific libraries.
  • Reduce the confusion between a "project" and "app".
  • Be backwards-compatible with existing Django projects.
  • Create folders and files automatically with sensible defaults for modern Python workflows that the majority of developers will need.

NOTE: this is a work in progress and is not yet ready for production use. If you are an expert Django developer, you might disagree with at least some of the opinions here. That's ok. There is a ton (too much?) of bike shedding around project creation. I am open to different opinions and feedback, but I am also focused on handling the 80/20 for new Django projects and provide some patterns based on my personal experience.

Guiding principles ๐Ÿ•ฏ๏ธ

  • There are three main use cases for Django: website, API, and worker; they serve different use cases, and each has a unique (but defined) file structure.
  • The distinction between "project" and "app" can be confusing for new developers, and creating a "project" without an "app" is an outlier.
  • Knowing when to use either django-admin or manage.py is a common source of confusion.
  • The DJANGO_SETTINGS_MODULE environment variable is flexible, but annoying to deal with; there should be simpler patterns for managing different environments.
  • Having a slightly non-ideal standard that mostly works for a majority of developers is better than no standard at all.

Hot takes ๐Ÿ”ฅ

  • Project-specific files, e.g. settings.py, should be in a config directory.
  • When creating a new app in a project, it should automatically be added to INSTALLED_APPS.
  • Tests should be written with pytest and should be located in a tests directory under the project root.
  • Settings should be split into multiple files per environment (e.g. config/settings/base.py, config/settings/production.py, etc.)

Usage ๐Ÿ“–

django-new is designed to be used with uvx or pipx.

uvx django-new [--api | --data | --web | --worker] [name] [folder]

django-new creates a standard folder structure for different use cases (based on the --api, --web, or --worker flag) along with a config folder to store "project-level" files like settings.py. django-new also creates a few typically used files (if they do not already exist) when creating a new application:

  • .env - Local Environment variables
  • .gitignore - git configuration
  • pyproject.toml - Configuration and dependencies
  • README.md - Documentation

Interactive mode

When no arguments are provided, django-new will prompt you for the application name and folder location.

uvx django-new

Create a new API

uvx django-new --api [name] [folder]
.
โ”œโ”€โ”€ api
โ”‚   โ”œโ”€โ”€ migrations
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ admin.py
โ”‚   โ”œโ”€โ”€ apps.py
โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ views.py
โ”œโ”€โ”€ config
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ asgi.py
โ”‚   โ”œโ”€โ”€ settings.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ wsgi.py
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Create a new data-only application

uvx django-new --data [name] [folder]
.
โ”œโ”€โ”€ data
โ”‚   โ”œโ”€โ”€ migrations
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ admin.py
โ”‚   โ”œโ”€โ”€ apps.py
โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ views.py
โ”œโ”€โ”€ config
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ asgi.py
โ”‚   โ”œโ”€โ”€ settings.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ wsgi.py
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Create a new website

uvx django-new --web [name] [folder]
.
โ”œโ”€โ”€ config
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ asgi.py
โ”‚   โ”œโ”€โ”€ settings.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ wsgi.py
โ”œโ”€โ”€ static
โ”‚   โ”œโ”€โ”€ css
โ”‚   โ”œโ”€โ”€ img
โ”‚   โ””โ”€โ”€ js
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ web
โ”‚   โ”œโ”€โ”€ migrations
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ templates
โ”‚   โ”œโ”€โ”€ templatetags
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ admin.py
โ”‚   โ”œโ”€โ”€ apps.py
โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ views.py
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Create a new worker

uvx django-new --worker [name] [folder]
.
โ”œโ”€โ”€ config
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ asgi.py
โ”‚   โ”œโ”€โ”€ settings.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ wsgi.py
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ worker
โ”‚   โ”œโ”€โ”€ migrations
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ admin.py
โ”‚   โ”œโ”€โ”€ apps.py
โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ””โ”€โ”€ tasks.py
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Create a new default application

uvx django-new [name] [folder]
.
โ”œโ”€โ”€ config
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ asgi.py
โ”‚   โ”œโ”€โ”€ settings.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ wsgi.py
โ”œโ”€โ”€ {name}
โ”‚   โ”œโ”€โ”€ migrations
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ admin.py
โ”‚   โ”œโ”€โ”€ apps.py
โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ views.py
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Create a new "minimal" application

Based on the minimal project in DEP-15, this will create a new Django project and app within a single directory.

uvx django-new --api --minimal [name] [folder]
uvx django-new --data --minimal [name] [folder]
uvx django-new --web --minimal [name] [folder]
uvx django-new --worker --minimal [name] [folder]
uvx django-new --minimal [name] [folder]
.
โ”œโ”€โ”€ {name}
โ”‚   โ”œโ”€โ”€ migrations
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ admin.py
โ”‚   โ”œโ”€โ”€ apps.py
โ”‚   โ”œโ”€โ”€ asgi.py
โ”‚   โ”œโ”€โ”€ models.py
โ”‚   โ”œโ”€โ”€ settings.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ”œโ”€โ”€ views.py
โ”‚   โ””โ”€โ”€ wsgi.py
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Create a new application based on a starter

Use the provided path to create a custom application.

uvx django-new --starter={path} [name] [folder]

Starters use the built-in Django startproject --template functionality under the hood.

The path passed into the starter option can be a directory, local archive file, or a remote URL. Remote URLs must point to an archive file using a http, https, or ftp protocol.

Supported archive file extensions: .zip, .tar, .tar.gz, .tar.bz2, .tar.xz, .tar.lzma, .tgz, .tbz2, .txz, .tlz

uvx django-new --starter=https://github.com/githubuser/django-app-template/archive/main.zip new_project

Starters from untrusted sources should be carefully inspected before use to prevent potential security issues.

Variable replacement

Starters can use variables that will be replaced in the included .py files using Django template syntax, like {{ project_name }}.

The context used for variable replacement:

{
    "project_name": "the project name provided to django-new, e.g. 'myproject'",
    "project_directory": "/full/path/to/the/myproject",
    "secret_key": "a randomly generated secret key",
    "docs_version": "version of the documentation",
    "django_version": "version of Django"
}

Add new app to an existing Django project

If a project already exists in the specified folder, django-new will add a new app to it. Use the same flags as above to create a specific type of app.

uvx django-new --api [name] [folder]
uvx django-new --data [name] [folder]
uvx django-new --web [name] [folder]
uvx django-new --worker [name] [folder]
uvx django-new [name] [folder]

Create a bare project

When a non-project folder is specified and an app should not be created, use the --project flag.

uvx django-new --project [name] [folder]
.
โ”œโ”€โ”€ config
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ asgi.py
โ”‚   โ”œโ”€โ”€ settings.py
โ”‚   โ”œโ”€โ”€ urls.py
โ”‚   โ””โ”€โ”€ wsgi.py
โ”œโ”€โ”€ tests
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ manage.py
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Create a bare app

When a non-project folder is specified and a project should not be created, use the --app flag.

uvx django-new --app [name] [folder]
.
โ””โ”€โ”€ {name}
    โ”œโ”€โ”€ migrations
    โ”‚   โ””โ”€โ”€ __init__.py
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ admin.py
    โ”œโ”€โ”€ apps.py
    โ”œโ”€โ”€ models.py
    โ”œโ”€โ”€ urls.py
    โ””โ”€โ”€ views.py

Inspiration โค๏ธ

Heavily inspired by DEP-15, although it approaches the solution from a different angle.

Tests

just test

Metadata

Release files for django-new 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-new 0.6.1
File Size Uploaded
django_new-0.6.1.tar.gz 22.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-new 0.6.1
File Interpreter ABI Platform
django_new-0.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 53.1 kB

Release files / django_new-0.6.1.tar.gz

Download URL django_new-0.6.1.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f4a7e01342cd5181f85ded3874da9e039fc22bbe836c8f5c2508cc77adf02e66
BLAKE2b-256 checksum
How to use checksums
ce6823f5abd0e8b20900cfc65ded9f9cbf7f685232082f71b7c52655fcb3629c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.

Transparency log

Release files / django_new-0.6.1-py3-none-any.whl

Download URL django_new-0.6.1-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee5816c72e5ac4ec86edf1ac6bc534f2f029b9d0180af5ac1a89b81b88213ef5
BLAKE2b-256 checksum
How to use checksums
713c3eb8487defdc7b834ac9002f6edc544e005ed59ba5ac6028f7e0d732bbdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 7, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.1 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.0

2 release 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