Skip to main content

Django prodserver

CI Status Documentation Status Test coverage percentage

uv Ruff pre-commit

PyPI Version Supported Python versions License


Documentation: https://django-prodserver.readthedocs.io

Source Code: https://github.com/nanorepublica/django-prodserver


A management command to start production servers/workers with a consistent interface

Installation

Install this via pip (or your favourite package manager):

pip install django-prodserver

Add the app to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "django_prodserver",
]

Configuration

Add the PRODUCTION_PROCESSES setting to your settings.py. Below shows an example with a web process and worker process defined.

The comments show other available backend processes that are available to use.

PRODUCTION_PROCESSES = {
    "web": {
        "BACKEND": "django_prodserver.backends.servers.gunicorn.GunicornServer",
        "ARGS": {"bind": "0.0.0.0:8111"},
    },
    # "web": {
    #     "BACKEND": "django_prodserver.backends.servers.granian.GranianASGIServer",
    #     "ARGS": {"address": "0.0.0.0", "port": "8000", "workers": "4"},
    # },
    # "web": {
    #     "BACKEND": "django_prodserver.backends.servers.granian.GranianWSGIServer",
    #     "ARGS": {"address": "0.0.0.0", "port": "8000", "workers": "4"},
    # },
    # "web": {
    #     "BACKEND": "django_prodserver.backends.servers.waitress.WaitressServer",
    #     "ARGS": {},
    # },
    # "web": {
    #     "BACKEND": "django_prodserver.backends.servers.uvicorn.UvicornServer",
    #     "ARGS": {},
    # },
    # "web": {
    #     "BACKEND": "django_prodserver.backends.servers.uvicorn.UvicornWSGIServer",
    #     "ARGS": {},
    # },
    "worker": {
        "BACKEND": "django_prodserver.backends.workers.celery.CeleryWorker",
        "APP": "tests.celery.app",
        "ARGS": {},
    },
    # "worker": {
    #     "BACKEND": "django_prodserver.backends.workers.django_tasks.DjangoTasksWorker",
    #     "ARGS": {},
    # },
    # "beat": {
    #     "BACKEND": "django_prodserver.backends.workers.celery.CeleryBeat",
    #     "APP": "tests.celery.app",
    #     "ARGS": {},
    # },
    # "flower": {
    #     "BACKEND": "django_prodserver.backends.servers.flower.CeleryFlower",
    #     "APP": "tests.celery.app",
    #     "ARGS": {"port": "5555", "address": "0.0.0.0"},
    # },
}

Usage

Once the PRODUCTION_PROCESSES setting has been configured you can then start the processes.

Use the server command to start a web/ASGI/WSGI process:

python manage.py server web

Use the worker command to start a background task worker process:

python manage.py worker worker

Both commands read from the same PRODUCTION_PROCESSES setting; server only accepts server backends and worker only accepts worker backends. If you point one at the wrong kind of backend it will tell you which command to use instead. Run either command with --list to see the configured process names.

Deprecated: python manage.py prodserver continues to work as an alias but is deprecated and will be removed in django-prodserver 4.0.0. Use python manage.py server instead.

Creating a new backend.

Creating a backend is fairly simple. Subclass BaseServerBackend (for a web server) or BaseWorkerBackend (for a background task worker) from django_prodserver.backends.base, then implement the start_server method which should call the underlying process in the best possible way for a production setting. You can also optionally override the prep_server_args method to aid with this to provide any default arguments or formatting to the start_server command.

See django_prodserver.backends.servers (production server backends), django_prodserver.backends.workers (worker backends), and django_prodserver.backends.dev (development runserver-style backends) for examples of existing backends for inspiration. Pull Request's are welcome for additional backends.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits

Copier

This package was created with Copier and the browniebroke/pypackage-template project template.

Metadata

Release files for django-prodserver 3.0.0

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-prodserver 3.0.0
File Size Uploaded
django_prodserver-3.0.0.tar.gz 36.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-prodserver 3.0.0
File Interpreter ABI Platform
django_prodserver-3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 69.4 kB

Release files / django_prodserver-3.0.0.tar.gz

Download URL django_prodserver-3.0.0.tar.gz
Size 36.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5e23ccd7338c26f2da203172b8ad2905ed4f2ae6b8f63b0e26c415dc5f9b2cfa
BLAKE2b-256 checksum
How to use checksums
e967732369cba62af180f224f20bf7ec02e95ad596b4e32d88eb6a8d2c67f312
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 13, 2026.

Transparency log

Release files / django_prodserver-3.0.0-py3-none-any.whl

Download URL django_prodserver-3.0.0-py3-none-any.whl
Size 33.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00a8173b58c639d24733c397ff49153c6bde32f375834254f82b20651be21ed8
BLAKE2b-256 checksum
How to use checksums
57c2141a7c3a067571f1c759925e8fb630f5fe3ad63814b5de5f703fcdaa7fdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.1

1 release file

2.1.0

2 release files

2.0.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