Skip to content

Commit 6357d9d

Browse files
committed
Add a new BATAI_WEB_URL setting to redirect to the frontend
1 parent 8b8bfd2 commit 6357d9d

8 files changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ jobs:
7373
DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django
7474
DJANGO_CELERY_BROKER_URL: amqp://localhost:5672/
7575
DJANGO_MINIO_STORAGE_URL: http://minioAccessKey:minioSecretKey@localhost:9000/django-storage-testing
76+
DJANGO_BATAI_WEB_URL: http://localhost:8080/

bats_ai/settings/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
# Django staticfiles auto-creates any intermediate directories, but do so here to prevent warnings.
9898
STATIC_ROOT.mkdir(exist_ok=True)
9999

100+
BATAI_WEB_URL: str = env.url("DJANGO_BATAI_WEB_URL").geturl()
101+
100102
BATAI_NABAT_API_URL: str = env.str(
101103
"DJANGO_BATAI_NABAT_API_URL", default="https://api.sciencebase.gov/nabat-graphql/graphql"
102104
)

bats_ai/urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.conf import settings
44
from django.contrib import admin
55
from django.urls import include, path
6+
from django.views.generic.base import RedirectView
67

78
from bats_ai.core.api import api
89

@@ -12,6 +13,7 @@
1213
path("admin/", admin.site.urls),
1314
path("api/v1/s3-upload/", include("s3_file_field.urls")),
1415
path("api/v1/", api.urls),
16+
path("", RedirectView.as_view(url=settings.BATAI_WEB_URL)),
1517
]
1618

1719
if settings.DEBUG:

dev/.env.docker-compose

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ DJANGO_MINIO_STORAGE_MEDIA_URL=http://localhost:9000/django-storage
1010
# access from non-internal addresses.
1111
DJANGO_INTERNAL_IPS=0.0.0.0/0
1212

13+
DJANGO_BATAI_WEB_URL=http://localhost:8080/
1314
SERVERHOSTNAME=localhost
1415

1516
VITE_API_ROOT=http://localhost:8000

dev/.env.docker-compose-native

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ DJANGO_DATABASE_URL=postgres://postgres:postgres@localhost:5432/django
33
DJANGO_CELERY_BROKER_URL=amqp://localhost:5672/
44
DJANGO_MINIO_STORAGE_URL=http://minioAccessKey:minioSecretKey@localhost:9000/django-storage
55

6+
DJANGO_BATAI_WEB_URL=http://localhost:8080/
67
SERVERHOSTNAME=localhost
78

89
VITE_API_ROOT=http://localhost:8000

prod/.env.kitware-production.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ DJANGO_SETTINGS_MODULE=bats_ai.settings.kitware_production
33
DJANGO_DATABASE_URL=postgres://postgres:postgres@postgres:5432/django
44
DJANGO_CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672/
55
DJANGO_MINIO_STORAGE_URL=http://minioAccessKey:minioSecretKey@minio:9000/django-storage
6+
DJANGO_BATAI_WEB_URL=https://batdetectai.kitware.com/
67
DJANGO_SECRET_KEY=changeme
78
# Values for docker service credentials, should match URLS
89
# if not using docker postgres or minio these should be removed from the docker-compose.prod.yml

prod/.env.nabat-production.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ DJANGO_ALLOWED_HOSTS=
2929

3030
# SUBPATH settings for a site like batdetectai.kitware.com/subpath being the host
3131
# if left blank there will be no subpath
32+
DJANGO_BATAI_WEB_URL=https://batdetectai.kitware.com/
3233
DJANGO_BATAI_URL_PATH=
3334
SERVERHOSTNAME=batdetectai.kitware.com
3435

terraform/django.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ module "django" {
3232
"https://[\\w-]+\\.bats-ai\\.pages\\.dev",
3333
]
3434
additional_django_vars = {
35-
DJANGO_SENTRY_DSN = "https://5bfdd2a77e7e8cbcea9ea873dbf9cbd6@o267860.ingest.us.sentry.io/4510800443015168"
35+
DJANGO_BATAI_WEB_URL = "https://www.bateval.com/"
36+
DJANGO_SENTRY_DSN = "https://5bfdd2a77e7e8cbcea9ea873dbf9cbd6@o267860.ingest.us.sentry.io/4510800443015168"
3637
}
3738
}
3839

0 commit comments

Comments
 (0)