Skip to content

Commit

Permalink
Get BUILT_ASSETS env for django_vite
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodwyer authored and evansd committed Aug 23, 2024
1 parent 0eb34f7 commit ab8c2e7
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions airlock/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,13 @@ def get_env_var(name):

ASSETS_DIST = BASE_DIR / "assets/dist"

STATICFILES_DIRS = [ASSETS_DIST, DOCS_DIR, BASE_DIR / "assets" / "out"]
# HACK ALERT! I generally don't like supplying defaults like this: ideally, all config
# would have to be explicitly defined in the environment but this is currently the only
# way to get things to work with docker-compose. See:
# https://github.com/opensafely-core/airlock/issues/634
BUILT_ASSETS = BASE_DIR / os.environ.get("BUILT_ASSETS", "assets/out")

STATICFILES_DIRS = [ASSETS_DIST, DOCS_DIR, BUILT_ASSETS]

# Sessions

Expand All @@ -268,7 +274,10 @@ def get_env_var(name):
WHITENOISE_USE_FINDERS = True

DJANGO_VITE = {
"default": {"dev_mode": False, "manifest_path": "assets/out/manifest.json"},
"default": {
"dev_mode": False,
"manifest_path": BUILT_ASSETS / "manifest.json",
},
"job_server": {
# vite assumes collectstatic, so tell it where the manifest is directly
"manifest_path": ASSETS_DIST / ".vite/manifest.json",
Expand Down

0 comments on commit ab8c2e7

Please sign in to comment.