Add environment variable to include Sub-Path in resolve.js.

This commit is contained in:
Alberto
2021-02-22 19:56:33 +01:00
parent e2b1115b3b
commit bccc41d177
2 changed files with 4 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ docker-compose:
environment: environment:
# all the other env # all the other env
- SCRIPT_NAME=/<sub path> - SCRIPT_NAME=/<sub path>
- JS_REVERSE_SCRIPT_PREFIX=/<sub path>/
- STATIC_URL=/<www path>/static/ - STATIC_URL=/<www path>/static/
- MEDIA_URL=/<www path>/media/ - MEDIA_URL=/<www path>/media/
labels: labels:
@@ -56,4 +57,4 @@ apache:
I used two paths `<sub path>` and `<www path>` for simplicity. In my case I have `<sub path> = recipes` and `<www path> = serve/recipes`. One could also change the matching rules of traefik to have everything under one path. I used two paths `<sub path>` and `<www path>` for simplicity. In my case I have `<sub path> = recipes` and `<www path> = serve/recipes`. One could also change the matching rules of traefik to have everything under one path.
I left out the TLS config in this example for simplicty. I left out the TLS config in this example for simplicty.

View File

@@ -228,6 +228,8 @@ LANGUAGES = [
# path for django_js_reverse to generate the javascript file containing all urls. Only done because the default command (collectstatic_js_reverse) fails to update the manifest # path for django_js_reverse to generate the javascript file containing all urls. Only done because the default command (collectstatic_js_reverse) fails to update the manifest
JS_REVERSE_OUTPUT_PATH = os.path.join(BASE_DIR, "cookbook/static/django_js_reverse") JS_REVERSE_OUTPUT_PATH = os.path.join(BASE_DIR, "cookbook/static/django_js_reverse")
JS_REVERSE_SCRIPT_PREFIX = os.getenv('JS_REVERSE_SCRIPT_PREFIX', '')
STATIC_URL = os.getenv('STATIC_URL', '/static/') STATIC_URL = os.getenv('STATIC_URL', '/static/')
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")