duck.backend.django.bridgeยถ

This module acts as a bridge between a Django server and a Duck server. It allows Django to handle requests that are originally meant for the Duck server.

Hereโ€™s how it works:

  1. Client sends a request: The client initiates a request to the Duck server.

  2. Duck server receives request: The Duck server receives the request first.

  3. Request forwarded to Django: The Duck server forwards the request to the Django server on the same network.

  4. Django processes request: Django handles the request as if the route was defined within Duck urls.py or in Django itself.

  5. Response sent to client: The response generated by Django is sent back to the client.

Module Contentsยถ

Functionsยถ

run_django_app_commands

Executes essential Django management commands, usually makemigrations, migrate, and collectstatic.

start_django_server

Starts the Django application server.

APIยถ

duck.backend.django.bridge.run_django_app_commands()ยถ

Executes essential Django management commands, usually makemigrations, migrate, and collectstatic.

This function ensures that the Django application is properly set up with the latest database schema and static files.

duck.backend.django.bridge.start_django_server(host_addr: str, port: int, uses_ipv6: bool = False)ยถ

Starts the Django application server.

Parameters:
  • host_addr โ€“ The host address to bind the server to.

  • port โ€“ The port to bind the server to.

  • uses_ipv6 โ€“ Whether host on ipv6 address