Skip to content

Commit 7d26900

Browse files
authored
Updates for production environment & deployments (#524)
* Disable default hosts for production * Support different API URLs per environment * Build storybook files in the same command
1 parent 8d10de4 commit 7d26900

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

config/settings/production.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
1717
SECRET_KEY = env("DJANGO_SECRET_KEY")
1818
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
19-
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["*"])
19+
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS")
2020

2121
# DATABASES
2222
# ------------------------------------------------------------------------------

ui/netlify.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
[[redirects]]
22
# Serve the api docs from /api/
3-
from = "/api/"
4-
to = "https://api.beluga.insectai.org/docs/"
3+
from = "/docs/"
4+
to = "API_BASE_URL_PLACEHOLDER/docs/:splat"
55
status = 200
66
force = true
77
headers = { X-From = "Netlify" }
88

99
[[redirects]]
1010
# Serve the external api endpints from /api/*
1111
from = "/api/*"
12-
to = "https://api.beluga.insectai.org/api/:splat"
12+
to = "API_BASE_URL_PLACEHOLDER/api/:splat"
1313
status = 200
1414
force = true
1515
headers = { X-From = "Netlify" }
1616

1717
[[redirects]]
1818
# Serve the external images from from /static/images/*
1919
from = "/static/captures/*"
20-
to = "https://api.beluga.insectai.org/static/captures/:splat"
20+
to = "API_BASE_URL_PLACEHOLDER/static/captures/:splat"
2121
status = 200
2222
force = true
2323
headers = { X-From = "Netlify" }
2424

2525
[[redirects]]
2626
# Serve the external images from from /static/images/*
2727
from = "/static/crops/*"
28-
to = "https://api.beluga.insectai.org/static/crops/:splat"
28+
to = "API_BASE_URL_PLACEHOLDER/static/crops/:splat"
2929
status = 200
3030
force = true
3131
headers = { X-From = "Netlify" }
@@ -46,4 +46,5 @@ force = false
4646

4747
[build]
4848
# Only trigger a build if the frontend code has changed
49+
command = "sed -i \"s|API_BASE_URL_PLACEHOLDER|${API_BASE_URL}|g\" netlify.toml && cat netlify.toml && yarn build && yarn build-storybook"
4950
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ./"

0 commit comments

Comments
 (0)