diff --git a/.github/workflows/podman.yml b/.github/workflows/podman.yml index 06ba9357b..08f9415ce 100644 --- a/.github/workflows/podman.yml +++ b/.github/workflows/podman.yml @@ -29,6 +29,7 @@ jobs: AML_CORS_ORIGIN_WHITELIST: ${{ vars.AML_CORS_ORIGIN_WHITELIST }} AML_DEBUG: ${{ vars.AML_DEBUG }} AML_LOCATION_PROVIDER: ${{ vars.AML_LOCATION_PROVIDER }} + AML_SUBPATH: ${{ vars.AML_SUBPATH }} DJANGO_SETTINGS_MODULE: ${{ vars.DJANGO_SETTINGS_MODULE }} SQL_DATABASE: ${{ vars.SQL_DATABASE }} SQL_HOST: ${{ vars.SQL_HOST }} diff --git a/backend/aml/base_settings.py b/backend/aml/base_settings.py index 911894c8c..c8f80a353 100644 --- a/backend/aml/base_settings.py +++ b/backend/aml/base_settings.py @@ -176,3 +176,5 @@ # We recommend adjusting this value in production. profiles_sample_rate=0.2, ) + +SUBPATH = os.getenv('AML_SUBPATH', None) diff --git a/backend/aml/urls.py b/backend/aml/urls.py index 501eab239..9444450fc 100644 --- a/backend/aml/urls.py +++ b/backend/aml/urls.py @@ -40,8 +40,10 @@ # ^ The static helper function only works in debug mode # (https://docs.djangoproject.com/en/3.0/howto/static-files/) -# Prefix all URLS with /server -urlpatterns = [path('server/', include(urlpatterns))] + +# Prefix all URLS with /server if AML_SUBPATH is set +if settings.SUBPATH: + urlpatterns = [path('server/', include(urlpatterns))] # Debug toolbar if settings.DEBUG: diff --git a/docker-compose-deploy.yml b/docker-compose-deploy.yml index c6a9fd51a..243f8bed4 100644 --- a/docker-compose-deploy.yml +++ b/docker-compose-deploy.yml @@ -44,6 +44,7 @@ services: - AML_CORS_ORIGIN_WHITELIST=${AML_CORS_ORIGIN_WHITELIST} - AML_LOCATION_PROVIDER=${AML_LOCATION_PROVIDER} - AML_SECRET_KEY=${AML_SECRET_KEY} + - AML_SUBPATH=${AML_SUBPATH} - DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} - DJANGO_SUPERUSER_USERNAME=${DJANGO_SUPERUSER_USERNAME} - DJANGO_SUPERUSER_EMAIL=${DJANGO_SUPERUSER_EMAIL}