django_prodserver.backends.dev package

Submodules

django_prodserver.backends.dev.daphne module

Pure-Python ASGI dev server backend mirroring channels runserver via Daphne.

class django_prodserver.backends.dev.daphne.DaphneRunserver(**server_args: Any)[source]

Bases: BaseRunserverBackend

ASGI development server backend driving daphne.Server directly.

Mirrors the behaviour of channels-runserver 3.0.5 (which Channels 4.x no longer ships) by calling out to Daphne’s public API and Django’s autoreload / system-check utilities, rather than going through any management command.

Configured entirely through the standard ARGS dict, with key names that match Daphne’s CLI flags 1:1:

{
    "BACKEND": "django_prodserver.backends.dev.daphne.DaphneRunserver",
    "ARGS": {
        "addrport": "127.0.0.1:8000",
        "ipv6": False,
        "noreload": False,
        "nostatic": False,
        "insecure": False,
        "http_timeout": None,
        "websocket_handshake_timeout": 5,
        # Full Daphne CLI surface also accepted:
        "unix_socket": None,
        "fd": None,
        "endpoints": [],
        "verbosity": 1,
        "root_path": "",
        "proxy_headers": False,
        "ping_interval": 20,
        "ping_timeout": 30,
        "application_close_timeout": 10,
        "websocket_timeout": 86400,
        "websocket_connect_timeout": 20,
        "request_buffer_size": 8192,
        "server_name": "daphne",
        "access_log": None,
    },
}

All keys are optional. nothreading is accepted for parity with DjangoRunserver but ignored — Daphne is single-reactor by design.

get_application() Any[source]

Resolve the ASGI app and conditionally wrap with ASGIStaticFilesHandler.

server_kind: str = 'ASGI development'

django_prodserver.backends.dev.django_runserver module

Pure-Python development server backend mirroring Django’s runserver.

class django_prodserver.backends.dev.django_runserver.DjangoRunserver(**server_args: Any)[source]

Bases: BaseRunserverBackend

Development server backend mirroring django.core.management.commands.runserver.

Configured entirely through the standard ARGS dict, with key names that match runserver’s CLI flags 1:1:

{
    "BACKEND": (
        "django_prodserver.backends.dev.django_runserver.DjangoRunserver"
    ),
    "ARGS": {
        "addrport": "127.0.0.1:8000",
        "ipv6": False,
        "noreload": False,
        "nothreading": False,
        "nostatic": False,
        "insecure": False,
    },
}

All keys are optional. Behaviour mirrors runserver’s inner_run by calling out to Django’s existing utilities (BaseCommand.check, basehttp.run, autoreload.run_with_reloader, StaticFilesHandler) rather than reimplementing them.

get_handler() Any[source]

Mirror runserver.get_handler + the staticfiles override.

server_kind: str = 'development'

django_prodserver.backends.dev.werkzeug module

Pure-Python WSGI dev server backend mirroring runserver_plus via Werkzeug.

class django_prodserver.backends.dev.werkzeug.RunserverPlus(**server_args: Any)[source]

Bases: WerkzeugRunserver

Alias for users coming from django-extensions runserver_plus.

class django_prodserver.backends.dev.werkzeug.WerkzeugRunserver(**server_args: Any)[source]

Bases: BaseRunserverBackend

WSGI dev server backend driving werkzeug.serving.run_simple directly.

Mirrors django-extensions’ runserver_plus 1:1 over the standard ARGS dict. ARGS keys match runserver_plus CLI flags:

{
    "BACKEND": "django_prodserver.backends.dev.werkzeug.WerkzeugRunserver",
    "ARGS": {
        # base (shared with DjangoRunserver / DaphneRunserver):
        "addrport": "127.0.0.1:8000",
        "ipv6": False,
        "noreload": False,
        "nostatic": False,
        "insecure": False,
        # run_simple kwargs:
        "threaded": True,
        "nothreading": False,
        "processes": 1,
        "extra_files": [],
        "exclude_patterns": [],
        "reloader_type": "auto",
        "reloader_interval": 1,
        "passthrough_errors": False,
        # debugger:
        "use_debugger": True,
        "nopin": False,
        "trusted_hosts": [],
        "evalex": True,
        # ssl:
        "cert_file": None,
        "key_file": None,
        "ssl_dev_cert_dir": None,
        # ergonomics:
        "browser": False,
        "output": None,
        "print_sql": False,
        "truncate_sql": 1000,
        "print_sql_location": False,
        "pdb": False,
        "ipdb": False,
        "pm": False,
        "keep_meta_shutdown": False,
        "startup_messages": "reload",
    },
}

Werkzeug owns reloading: start_server does NOT wrap with django.utils.autoreload.run_with_reloader; instead run_simple is given use_reloader=... and forks/spawns its own child.

cert_file: str | None
get_handler() Any[source]

Mirror runserver.get_handler + the staticfiles override.

key_file: str | None
output_path: str | None
server_kind: str = 'Werkzeug development'
ssl_dev_cert_dir: str | None
start_server(*args: str) None[source]

Werkzeug owns reloading; do NOT wrap with django.utils.autoreload.