diff --git a/api/Dockerfile b/api/Dockerfile index 6abcc1e1be1..cd3bc5d35c4 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -102,6 +102,7 @@ COPY --chown=opener . /api/ RUN env \ SETUP_ES="False" \ DJANGO_SECRET_KEY="any string" \ + CANONICAL_DOMAIN="" \ python manage.py collectstatic # Add the release version to the docker container diff --git a/api/api/docs/base_docs.py b/api/api/docs/base_docs.py index d2cd6b5b9e1..483e051af46 100644 --- a/api/api/docs/base_docs.py +++ b/api/api/docs/base_docs.py @@ -2,6 +2,7 @@ from textwrap import dedent from typing import Literal +from django.conf import settings from rest_framework.exceptions import ( NotAuthenticated, NotFound, @@ -114,7 +115,7 @@ def get_operation_id(self) -> str: def build_source_path_parameter(media_type: MediaType): valid_description = ( f"Valid values are source_names from the stats endpoint: " - f"https://api.openverse.engineering/v1/{media_type}/stats/." + f"{settings.CANONICAL_ORIGIN}/v1/{media_type}/stats/." ) return OpenApiParameter( diff --git a/api/api/examples/audio_requests.py b/api/api/examples/audio_requests.py index f1b9128e372..ed623adc85d 100644 --- a/api/api/examples/audio_requests.py +++ b/api/api/examples/audio_requests.py @@ -1,10 +1,7 @@ -import os +from api.examples.environment import ORIGIN, TOKEN -token = os.getenv("AUDIO_REQ_TOKEN", "DLBYIcfnKfolaXKcmMC8RIDCavc2hW") -origin = os.getenv("AUDIO_REQ_ORIGIN", "https://api.openverse.engineering") - -auth = f'-H "Authorization: Bearer {token}"' if token else "" +auth = f'-H "Authorization: Bearer {TOKEN}"' if TOKEN else "" identifier = "8624ba61-57f1-4f98-8a85-ece206c319cf" syntax_examples = { @@ -25,7 +22,7 @@ # Example {index}: Search for audio {purpose} curl \\ {auth} \\ - "{origin}/v1/audio/?q={syntax}" + "{ORIGIN}/v1/audio/?q={syntax}" """ for (index, (purpose, syntax)) in enumerate(syntax_examples.items()) ) @@ -34,28 +31,28 @@ # Search for music titled "Wish You Were Here" by The.madpix.project curl \\ {auth} \\ - "{origin}/v1/audio/?title=Wish%20You%20Were%20Here&creator=The.madpix.project" + "{ORIGIN}/v1/audio/?title=Wish%20You%20Were%20Here&creator=The.madpix.project" """ audio_stats_curl = f""" # Get the statistics for audio sources curl \\ {auth} \\ - "{origin}/v1/audio/stats/" + "{ORIGIN}/v1/audio/stats/" """ audio_detail_curl = f""" # Get the details of audio ID {identifier} curl \\ {auth} \\ - "{origin}/v1/audio/{identifier}/" + "{ORIGIN}/v1/audio/{identifier}/" """ audio_related_curl = f""" # Get related audio files for audio ID {identifier} curl \\ {auth} \\ - "{origin}/v1/audio/{identifier}/related/" + "{ORIGIN}/v1/audio/{identifier}/related/" """ audio_complain_curl = f""" @@ -65,12 +62,12 @@ -H "Content-Type: application/json" \\ {auth} \\ -d '{{"reason": "mature", "description": "This audio contains sensitive content"}}' \\ - "{origin}/v1/audio/{identifier}/report/" + "{ORIGIN}/v1/audio/{identifier}/report/" """ audio_waveform_curl = f""" # Get the waveform of audio ID {identifier} curl \\ {auth} \\ - "{origin}/v1/audio/{identifier}/waveform/" + "{ORIGIN}/v1/audio/{identifier}/waveform/" """ diff --git a/api/api/examples/audio_responses.py b/api/api/examples/audio_responses.py index c59f6c1982d..64dd6f03352 100644 --- a/api/api/examples/audio_responses.py +++ b/api/api/examples/audio_responses.py @@ -1,8 +1,6 @@ -import os +from api.examples.environment import ORIGIN -origin = os.getenv("AUDIO_REQ_ORIGIN", "https://api.openverse.engineering") - identifier = "8624ba61-57f1-4f98-8a85-ece206c319cf" base_audio = { @@ -50,10 +48,10 @@ "duration": 270000, "bit_rate": 128000, "sample_rate": 44100, - "thumbnail": f"{origin}/v1/audio/{identifier}/thumb/", - "detail_url": f"{origin}/v1/audio/{identifier}/", - "related_url": f"{origin}/v1/audio/{identifier}/related/", - "waveform": f"{origin}/v1/audio/{identifier}/waveform/", + "thumbnail": f"{ORIGIN}/v1/audio/{identifier}/thumb/", + "detail_url": f"{ORIGIN}/v1/audio/{identifier}/", + "related_url": f"{ORIGIN}/v1/audio/{identifier}/related/", + "waveform": f"{ORIGIN}/v1/audio/{identifier}/waveform/", "unstable__sensitivity": [], } @@ -124,8 +122,8 @@ "license_version": "2.0", "license_url": "https://creativecommons.org/licenses/by-sa/2.0/", "foreign_landing_url": "https://commons.wikimedia.org/w/index.php?curid=3536953", # noqa: E501 - "detail_url": "http://api.openverse.engineering/v1/audio/36537842-b067-4ca0-ad67-e00ff2e06b2e", # noqa: E501 - "related_url": "http://api.openverse.engineering/v1/recommendations/audio/36537842-b067-4ca0-ad67-e00ff2e06b2e", # noqa: E501 + "detail_url": f"{ORIGIN}/v1/audio/36537842-b067-4ca0-ad67-e00ff2e06b2e", # noqa: E501 + "related_url": f"{ORIGIN}/v1/recommendations/audio/36537842-b067-4ca0-ad67-e00ff2e06b2e", # noqa: E501 "fields_matched": ["description", "title"], "tags": [{"name": "exam"}, {"name": "tactics"}], } diff --git a/api/api/examples/environment.py b/api/api/examples/environment.py new file mode 100644 index 00000000000..e5848a16ce4 --- /dev/null +++ b/api/api/examples/environment.py @@ -0,0 +1,7 @@ +import os + + +TOKEN = os.getenv("REQUEST_TOKEN", "") +DOMAIN = os.getenv("CANONICAL_DOMAIN") +_proto = "http" if "localhost" in DOMAIN else "https" +ORIGIN = f"{_proto}://{DOMAIN}" diff --git a/api/api/examples/image_requests.py b/api/api/examples/image_requests.py index 3524e47452b..5c7f6e165c6 100644 --- a/api/api/examples/image_requests.py +++ b/api/api/examples/image_requests.py @@ -1,10 +1,7 @@ -import os +from api.examples.environment import ORIGIN, TOKEN -token = os.getenv("AUDIO_REQ_TOKEN", "DLBYIcfnKfolaXKcmMC8RIDCavc2hW") -origin = os.getenv("AUDIO_REQ_ORIGIN", "https://api.openverse.engineering") - -auth = f'-H "Authorization: Bearer {token}"' if token else "" +auth = f'-H "Authorization: Bearer {TOKEN}"' if TOKEN else "" identifier = "4bc43a04-ef46-4544-a0c1-63c63f56e276" syntax_examples = { @@ -25,7 +22,7 @@ # Example {index}: Search for images {purpose} curl \\ {auth} \\ - "{origin}/v1/images/?q={syntax}" + "{ORIGIN}/v1/images/?q={syntax}" """ for (index, (purpose, syntax)) in enumerate(syntax_examples.items()) ) @@ -34,28 +31,28 @@ # Search for images titled "Bark" by Sullivan curl \\ {auth} \\ - "{origin}/v1/images/?title=Bark&creator=Sullivan" + "{ORIGIN}/v1/images/?title=Bark&creator=Sullivan" """ image_stats_curl = f""" # Get the statistics for image sources curl \\ {auth} \\ - "{origin}/v1/images/stats/" + "{ORIGIN}/v1/images/stats/" """ image_detail_curl = f""" # Get the details of image ID {identifier} curl \\ {auth} \\ - "{origin}/v1/images/{identifier}/" + "{ORIGIN}/v1/images/{identifier}/" """ image_related_curl = f""" # Get related images for image ID {identifier} curl \\ {auth} \\ - "{origin}/v1/images/{identifier}/related/" + "{ORIGIN}/v1/images/{identifier}/related/" """ image_complain_curl = f""" @@ -65,12 +62,12 @@ -H "Content-Type: application/json" \\ {auth} \\ -d '{{"reason": "mature", "description": "Image contains sensitive content"}}' \\ - "{origin}/v1/images/{identifier}/report/" + "{ORIGIN}/v1/images/{identifier}/report/" """ image_oembed_curl = f""" # Retrieve embedded content from an image's URL curl \\ {auth} \\ - "{origin}/v1/images/oembed/?url=https://wordpress.org/openverse/photos/{identifier}" + "{ORIGIN}/v1/images/oembed/?url=https://wordpress.org/openverse/photos/{identifier}" """ diff --git a/api/api/examples/image_responses.py b/api/api/examples/image_responses.py index 1c472c230b9..7db0ff3a18c 100644 --- a/api/api/examples/image_responses.py +++ b/api/api/examples/image_responses.py @@ -1,8 +1,6 @@ -import os +from api.examples.environment import ORIGIN -origin = os.getenv("AUDIO_REQ_ORIGIN", "https://api.openverse.engineering") - identifier = "4bc43a04-ef46-4544-a0c1-63c63f56e276" base_image = { @@ -53,9 +51,9 @@ "mature": False, "height": 4016, "width": 6016, - "thumbnail": f"{origin}/v1/images/{identifier}/thumb/", - "detail_url": f"{origin}/v1/images/{identifier}/", - "related_url": f"{origin}/v1/images/{identifier}/related/", + "thumbnail": f"{ORIGIN}/v1/images/{identifier}/thumb/", + "detail_url": f"{ORIGIN}/v1/images/{identifier}/", + "related_url": f"{ORIGIN}/v1/images/{identifier}/related/", "unstable__sensitivity": [], } @@ -120,15 +118,15 @@ "creator_url": "https://www.flickr.com/photos/18090920@N07", "tags": [{"name": "exam"}, {"name": "tactics"}], "url": "https://live.staticflickr.com/4065/4459771899_07595dc42e.jpg", # noqa: E501 - "thumbnail": "https://api.openverse.engineering/v1/thumbs/610756ec-ae31-4d5e-8f03-8cc52f31b71d", # noqa: E501 + "thumbnail": f"{ORIGIN}/v1/thumbs/610756ec-ae31-4d5e-8f03-8cc52f31b71d", # noqa: E501 "provider": "flickr", "source": "flickr", "license": "by", "license_version": "2.0", "license_url": "https://creativecommons.org/licenses/by/2.0/", "foreign_landing_url": "https://www.flickr.com/photos/18090920@N07/4459771899", # noqa: E501 - "detail_url": "http://api.openverse.engineering/v1/images/610756ec-ae31-4d5e-8f03-8cc52f31b71d", # noqa: E501 - "related_url": "http://api.openverse.engineering/v1/recommendations/images/610756ec-ae31-4d5e-8f03-8cc52f31b71d", # noqa: E501 + "detail_url": f"{ORIGIN}/v1/images/610756ec-ae31-4d5e-8f03-8cc52f31b71d", # noqa: E501 + "related_url": f"{ORIGIN}/v1/recommendations/images/610756ec-ae31-4d5e-8f03-8cc52f31b71d", # noqa: E501 } ], } diff --git a/api/api/examples/oauth2_requests.py b/api/api/examples/oauth2_requests.py index 4b8222d897b..0ab45fcb2a1 100644 --- a/api/api/examples/oauth2_requests.py +++ b/api/api/examples/oauth2_requests.py @@ -1,10 +1,7 @@ -import os +from api.examples.environment import ORIGIN, TOKEN -token = os.getenv("AUDIO_REQ_TOKEN", "DLBYIcfnKfolaXKcmMC8RIDCavc2hW") -origin = os.getenv("AUTH_REQ_ORIGIN", "https://api.openverse.engineering") - -auth = f'-H "Authorization: Bearer {token}"' if token else "" +auth = f'-H "Authorization: Bearer {TOKEN}"' if TOKEN else "" auth_register_curl = f""" # Register for a key @@ -12,7 +9,7 @@ -X POST \\ -H "Content-Type: application/json" \\ -d '{{"name": "My amazing project", "description": "To access Openverse API", "email": "user@example.com"}}' \\ - "{origin}/v1/auth_tokens/register/" + "{ORIGIN}/v1/auth_tokens/register/" """ # noqa: E501 auth_token_curl = f""" @@ -20,12 +17,12 @@ curl \\ -X POST \\ -H "Content-Type: application/x-www-form-urlencoded" \\ - -d 'grant_type=client_credentials&client_id=pm8GMaIXIhkjQ4iDfXLOvVUUcIKGYRnMlZYApbda&client_secret=YhVjvIBc7TuRJSvO2wIi344ez5SEreXLksV7GjalLiKDpxfbiM8qfUb5sNvcwFOhBUVzGNdzmmHvfyt6yU3aGrN6TAbMW8EOkRMOwhyXkN1iDetmzMMcxLVELf00BR2e' \\ - "{origin}/v1/auth_tokens/token/" + -d 'grant_type=client_credentials&client_id=&client_secret=' \\ + "{ORIGIN}/v1/auth_tokens/token/" """ # noqa: E501 auth_key_info_curl = f""" curl \\ {auth} \\ - "{origin}/v1/rate_limit/" + "{ORIGIN}/v1/rate_limit/" """ diff --git a/api/api/examples/oauth2_responses.py b/api/api/examples/oauth2_responses.py index d6859f6f5bf..54173f6076d 100644 --- a/api/api/examples/oauth2_responses.py +++ b/api/api/examples/oauth2_responses.py @@ -1,17 +1,14 @@ auth_register_201_example = { "application/json": { "name": "My amazing project", - "client_id": "pm8GMaIXIhkjQ4iDfXLOvVUUcIKGYRnMlZYApbda", - "client_secret": ( - "YhVjvIBc7TuRJSvO2wIi344ez5SEreXLksV7GjalLiKDpxfbiM8qfUb5sNvcwFOh" - "BUVzGNdzmmHvfyt6yU3aGrN6TAbMW8EOkRMOwhyXkN1iDetmzMMcxLVELf00BR2e" - ), + "client_id": "", + "client_secret": "", } } auth_token_200_example = { "application/json": { - "access_token": "DLBYIcfnKfolaXKcmMC8RIDCavc2hW", + "access_token": "", "scope": "read write groups", "expires_in": 36000, "token_type": "Bearer", diff --git a/api/api/models/media.py b/api/api/models/media.py index fead18dcc87..e7c9fac3fef 100644 --- a/api/api/models/media.py +++ b/api/api/models/media.py @@ -145,8 +145,6 @@ class AbstractMediaReport(models.Model): deleted_class: type[models.Model] = None """the class storing deleted media e.g. ``DeletedImage`` or ``DeletedAudio``""" - BASE_URL = settings.BASE_URL - REPORT_CHOICES = [(MATURE, MATURE), (DMCA, DMCA), (OTHER, OTHER)] STATUS_CHOICES = [ @@ -201,9 +199,7 @@ def clean(self): ) def url(self, media_type): - url = ( - f"{AbstractMediaReport.BASE_URL}v1/{media_type}/{self.media_obj.identifier}" - ) + url = f"{settings.CANONICAL_ORIGIN}v1/{media_type}/{self.media_obj.identifier}" return format_html(f"{url}") def save(self, *args, **kwargs): diff --git a/api/api/serializers/media_serializers.py b/api/api/serializers/media_serializers.py index 350d416a66a..26fdd521e52 100644 --- a/api/api/serializers/media_serializers.py +++ b/api/api/serializers/media_serializers.py @@ -633,7 +633,7 @@ class MediaSearchRequestSourceSerializer(serializers.Serializer): "help_text": ( "A comma separated list of data sources; valid values are " "``source_name``s from the stats endpoint: " - f"https://api.openverse.engineering/v1/{media_path}/stats/." + f"{settings.CANONICAL_ORIGIN}/v1/{media_path}/stats/." ), "required": False, } diff --git a/api/conf/settings/security.py b/api/conf/settings/security.py index cf78fda3891..5eca87052f8 100644 --- a/api/conf/settings/security.py +++ b/api/conf/settings/security.py @@ -16,27 +16,38 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = config("DJANGO_DEBUG_ENABLED", default=False, cast=bool) -ALLOWED_HOSTS = config("ALLOWED_HOSTS", default="").split(",") + [ +# The domain we treat as "canonical" for this API instance, e.g., `api.` subdomain for production +CANONICAL_DOMAIN: str = config("CANONICAL_DOMAIN") # required + +_proto = "http" if "localhost" in CANONICAL_DOMAIN else "https" +CANONICAL_ORIGIN: str = f"{_proto}://{CANONICAL_DOMAIN}" + +# Additional domains we serve for this API instance, e.g., `api-production.` subdomain for production +ADDITIONAL_DOMAINS: list[str] = config( + "ADDITIONAL_DOMAINS", default="", cast=lambda x: x.split(",") +) + +ALL_DOMAINS = [CANONICAL_DOMAIN] + ADDITIONAL_DOMAINS + +ALLOWED_HOSTS = [ + # Strip ports off hosts, as ALLOWED_HOSTS does not work with ports, e.g., `localhost:8000` needs to be just `localhost` + domain.split(":")[0] + for domain in ALL_DOMAINS +] + [ gethostname(), gethostbyname(gethostname()), ] -if lb_url := config("LOAD_BALANCER_URL", default=""): - ALLOWED_HOSTS.append(lb_url) - if DEBUG: ALLOWED_HOSTS += [ "dev.openverse.test", # used in local development - "localhost", "127.0.0.1", "0.0.0.0", ] -BASE_URL = config("BASE_URL", default="https://api.openverse.engineering/") - # Trusted origins for CSRF # https://docs.djangoproject.com/en/4.2/ref/settings/#csrf-trusted-origins -CSRF_TRUSTED_ORIGINS = ["https://*.openverse.engineering"] +CSRF_TRUSTED_ORIGINS = [f"{_proto}://{domain}" for domain in ALL_DOMAINS] # Allow anybody to access the API from any domain if "corsheaders" not in INSTALLED_APPS: @@ -57,8 +68,6 @@ # Proxy handling, for production if config("IS_PROXIED", default=True, cast=bool): - # https://docs.djangoproject.com/en/4.0/ref/settings/#use-x-forwarded-host - USE_X_FORWARDED_HOST = True # https://docs.djangoproject.com/en/4.0/ref/settings/#secure-proxy-ssl-header SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") diff --git a/api/env.docker b/api/env.docker index daf913ecf45..179c6102709 100644 --- a/api/env.docker +++ b/api/env.docker @@ -4,9 +4,13 @@ DJANGO_SETTINGS_MODULE=conf.settings DJANGO_SECRET_KEY=example_key DJANGO_DEBUG_ENABLED=True -BASE_URL=http://localhost:50280/ +CANONICAL_DOMAIN=localhost:50280 +# Use the same port inside the container, as outside, so that references to CANONICAL_DOMAIN work inside the container +# Otherwise, `localhost:50280` inside the container wouldn't work, due to 50280 being the port mapped on the host, without +# the actual port matching (usually defaulting to 8000). +PORT=50280 +ALTERNATIVE_DOMAINS=172.17.0.1,host.docker.internal ENVIRONMENT=local -ALLOWED_HOSTS=api.openverse.engineering,api-dev.openverse.engineering,host.docker.internal REDIS_HOST=cache diff --git a/api/env.template b/api/env.template index 0c0cc84bc2a..a6d6f9b6e6e 100644 --- a/api/env.template +++ b/api/env.template @@ -4,10 +4,8 @@ DJANGO_SETTINGS_MODULE=conf.settings DJANGO_SECRET_KEY=example_key DJANGO_DEBUG_ENABLED=True -BASE_URL=http://localhost:50280/ +CANONICAL_DOMAIN=localhost:50280 ENVIRONMENT=local -# List of comma-separated hosts/domain names, e.g., 127.17.0.1,local.app -ALLOWED_HOSTS=localhost,172.17.0.1,host.docker.internal #LOAD_BALANCER_URL= diff --git a/api/run.py b/api/run.py index 36938287d25..4fc6be16c62 100644 --- a/api/run.py +++ b/api/run.py @@ -1,15 +1,15 @@ -import os - import uvicorn +from decouple import config if __name__ == "__main__": - is_local = os.getenv("ENVIRONMENT") == "local" + is_local = config("ENVIRONMENT") == "local" + port: int = config("PORT", default="8000", cast=int) uvicorn.run( "conf.asgi:application", host="0.0.0.0", - port=8000, + port=port, workers=1, reload=is_local, log_level="debug", diff --git a/api/test/__init__.py b/api/test/__init__.py index 205a8f12757..e69de29bb2d 100644 --- a/api/test/__init__.py +++ b/api/test/__init__.py @@ -1,5 +0,0 @@ -from test.utils import show_env_name - - -print("\n") -show_env_name() diff --git a/api/test/constants.py b/api/test/constants.py deleted file mode 100644 index 7254fe5ac3d..00000000000 --- a/api/test/constants.py +++ /dev/null @@ -1,10 +0,0 @@ -import os - - -API_URL = os.getenv("INTEGRATION_TEST_URL", "http://localhost:8000") - -KNOWN_ENVS = { - "http://localhost:8000": "LOCAL", - "https://api.openverse.engineering": "PRODUCTION", - "https://api-dev.openverse.engineering": "TESTING", -} diff --git a/api/test/integration/test_auth.py b/api/test/integration/test_auth.py index b6a7b492194..d0e798af145 100644 --- a/api/test/integration/test_auth.py +++ b/api/test/integration/test_auth.py @@ -1,13 +1,13 @@ import time import uuid +from django.conf import settings from django.urls import reverse import pytest from oauth2_provider.models import AccessToken from api.models import OAuth2Verification, ThrottledApplication -from test.constants import API_URL cache_availability_params = pytest.mark.parametrize( @@ -98,7 +98,7 @@ def _integration_verify_most_recent_token(api_client): ) @cache_availability_params @pytest.mark.skipif( - API_URL != "http://localhost:8000", + "localhost" not in settings.CANONICAL_DOMAIN, reason=( "This test needs to cheat by looking in the database," " so it needs to skip in non-local environments where" diff --git a/api/test/test_examples.py b/api/test/test_examples.py index e7ff9d648e1..858c54a21c6 100644 --- a/api/test/test_examples.py +++ b/api/test/test_examples.py @@ -2,14 +2,13 @@ import os import subprocess -import pytest +from django.conf import settings -from test.constants import API_URL +import pytest -os.environ["AUDIO_REQ_TOKEN"] = "" -os.environ["AUDIO_REQ_ORIGIN"] = API_URL -os.environ["AUDIO_REQ_IDX"] = "8624ba61-57f1-4f98-8a85-ece206c319cf" +os.environ["REQUEST_TOKEN"] = "" +os.environ["CANONICAL_DOMAIN"] = settings.CANONICAL_DOMAIN from api.examples import ( # noqa: E402 | Set env vars before import audio_mappings, @@ -18,8 +17,12 @@ def execute_request(request): - proc = subprocess.run(request, check=True, capture_output=True, shell=True) - return json.loads(proc.stdout) + try: + proc = subprocess.run(request, check=True, capture_output=True, shell=True) + return json.loads(proc.stdout) + except subprocess.CalledProcessError as e: + print(e.stderr) + raise @pytest.mark.parametrize("in_val, out_val", list(audio_mappings.items())) diff --git a/api/test/test_schema.py b/api/test/test_schema.py index 38219f027e9..16d10df0e49 100644 --- a/api/test/test_schema.py +++ b/api/test/test_schema.py @@ -1,9 +1,9 @@ -import schemathesis +from django.conf import settings -from test.constants import API_URL +import schemathesis -schema = schemathesis.from_uri(f"{API_URL}/v1/schema/") +schema = schemathesis.from_uri(f"{settings.CANONICAL_ORIGIN}/v1/schema/") @schema.parametrize() diff --git a/api/test/utils.py b/api/test/utils.py deleted file mode 100644 index 37af9250f98..00000000000 --- a/api/test/utils.py +++ /dev/null @@ -1,7 +0,0 @@ -from test.constants import API_URL, KNOWN_ENVS - - -def show_env_name(): - env_name = KNOWN_ENVS.get(API_URL, "unknown") - message = f"with API {API_URL}" if env_name == "unknown" else "" - print(f"Testing {env_name} environment {message}") diff --git a/docker-compose.yml b/docker-compose.yml index 7e87d00e6a5..df894f22295 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -228,7 +228,7 @@ services: volumes: - ./api:/api:z ports: - - "50280:8000" # Django + - "50280:50280" depends_on: - db - es @@ -300,7 +300,7 @@ services: ports: - "50270:8080" environment: - DJANGO_NGINX_UPSTREAM_URL: web:8000 + DJANGO_NGINX_UPSTREAM_URL: web:50280 depends_on: - web