runner
dev_tool.services.django.runner
log = logging.getLogger(__name__)
module-attribute
ServerRunner
Bases: Protocol
A protocol for server runners.
run
DjangoServerRunner
Bases: BaseProcessRunner
A class for running a Django development server.
This class handles starting, monitoring, and stopping a Django server process in both local and containerized environments.
The constructor for the DjangoServerRunner class.
In containerized mode the server binds the container's own app port, which is the port nginx proxies to, so the port given here is only the host port the project is published on.
Parameters:
-
project_name(str) –The project name for container naming.
-
ip_address(str) –The IP address to bind to.
-
port(int) –The host port the project is published on.
Source code in dev_tool/services/django/runner.py
ip_address = ip_address
instance-attribute
port = port
instance-attribute
GunicornServerRunner
Bases: BaseProcessRunner
A class for running a Gunicorn server inside a container.
This class handles starting, monitoring, and stopping a Gunicorn process using the project's gunicorn.conf.py configuration file. A temporary WSGI wrapper module is created in the container to serve static files via Django's StaticFilesHandler.
The constructor for the GunicornServerRunner class.
Gunicorn always runs inside the app container and binds the container's own app port, which is the port nginx proxies to, so this port is only the host port the project is published on.
Parameters:
-
project_name(str) –The project name for container naming.
-
port(int) –The host port the project is published on.
-
wsgi_app(str) –The WSGI application module path in gunicorn format.
-
wrapper_content(str) –The rendered WSGI wrapper module content.