apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: web-django
  title: Python — Django (batteries-included)
  description: |
    Full-stack Python web app with admin, ORM, auth, forms, templates,
    and migrations. Pick this when batteries-included conventions
    matter more than minimal surface area.
  tags:
    - python
    - web
    - django
  links:
    - url: https://docs.djangoproject.com/
      title: Django
    - url: https://docs.astral.sh/uv/
      title: uv
    - url: https://pytest-django.readthedocs.io/
      title: pytest-django
    - url: https://docs.astral.sh/ruff/
      title: ruff
spec:
  owner: abp
  type: website
  parameters:
    - title: Stack Configuration
      required:
        - database
      properties:
        backend:
          title: Backend
          type: string
          const: django
        frontend:
          title: Frontend
          type: string
          const: server-rendered-templates
          description: |
            Django templates with optional HTMX overlays. For a separate
            JS frontend pair with frontend-spa or fullstack-sveltekit and
            treat this template as the API.
        database:
          title: Database
          type: string
          enum:
            - postgres
            - sqlite
          enumNames:
            - 'Postgres — default for production'
            - 'SQLite — development / single-process'
        background_jobs:
          title: Background Jobs
          type: string
          default: none
          enum:
            - none
            - celery
            - rq
            - arq
          enumNames:
            - 'None'
            - 'Celery — Redis or RabbitMQ broker'
            - 'RQ — Redis-only, simpler'
            - 'arq — asyncio-native'
        auth:
          title: Authentication
          type: string
          default: django-native
          enum:
            - django-native
            - allauth
            - none
          enumNames:
            - 'Django auth — built-in user model + sessions'
            - 'django-allauth — social + email/password'
            - 'None — public site'
        observability:
          title: Observability
          type: string
          default: none
          enum:
            - none
            - opentelemetry
          enumNames:
            - 'None'
            - 'OpenTelemetry'
  tooling:
    package_manager: uv
    language_flavor: python
    type_checker: mypy
    test_runner: pytest-django
    lint_format: ruff
    runtime_cli: django-admin
  smoke_test: |
    GET / returns 200 with the Django welcome content. One pytest
    test uses the Django test client and asserts the status.
  switch_when: |
    Pure API with no admin/templates → api-fastapi. High-throughput
    serialisation matters more than ecosystem breadth → consider
    Litestar (future sibling).
