Skip to content

Multiple applications

One DjangoDeployment shares:

  • Storage account and CDN
  • PostgreSQL Flexible Server
  • App Service subnet and (by default) App Service plan
  • pgAdmin

Call add_django_website once per Django app:

django.add_django_website(
    name="site_a",
    db_name="site_a",
    repository_url="git@gitlab.com:org/site-a.git",
    repository_branch="main",
    website_hosts=[HostDefinition("a.example.com")],
    django_settings_module="site_a.settings.production",
    environment_variables={},
    secrets={},
)

django.add_django_website(
    name="site_b",
    db_name="site_b",
    repository_url="git@gitlab.com:org/site-b.git",
    repository_branch="main",
    website_hosts=[HostDefinition("b.example.com")],
    django_settings_module="site_b.settings.production",
    environment_variables={},
    secrets={},
    dedicated_app_service_sku=azure.web.SkuDescriptionArgs(
        name="B2",
        tier="Basic",
    ),  # optional dedicated plan for this app only
)

Each site gets its own database, blob containers ({name}-media, {name}-static), Key Vault, Web App, exports ({name}_site_*), and optional ACS/Redis.

Use distinct name values — they prefix Azure resource names and exports.