Serve static assets with whitenoise
This commit is contained in:
parent
cb030cb4a1
commit
be49709a1f
@ -81,9 +81,6 @@ Alternatively, you may bind-mount a local course-discovery repository by adding
|
||||
discovery:
|
||||
volumes:
|
||||
- /path/to/course-discovery/:/openedx/discovery
|
||||
discovery-assets:
|
||||
volumes:
|
||||
- /path/to/course-discovery/:/openedx/discovery
|
||||
|
||||
Once a local repository is mounted in the image, you will have to install nodejs dependencies and collect static assets::
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
__version__ = "10.1.0"
|
||||
__version__ = "10.1.1"
|
||||
|
||||
@ -1,6 +0,0 @@
|
||||
- name: init-discovery-staticfiles
|
||||
image: {{ DISCOVERY_DOCKER_IMAGE }}
|
||||
args: ['cp', '-r', '/openedx/discovery/course_discovery/assets/', '/var/www/discovery/assets']
|
||||
volumeMounts:
|
||||
- mountPath: /var/www/discovery/
|
||||
name: discovery-staticfiles
|
||||
@ -10,9 +10,3 @@ discovery:
|
||||
- mysql
|
||||
{% if ACTIVATE_LMS %}- lms{% endif %}
|
||||
{% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %}
|
||||
|
||||
discovery-assets:
|
||||
image: {{ DISCOVERY_DOCKER_IMAGE }}
|
||||
volumes:
|
||||
- ../../data/discovery:/var/www/discovery
|
||||
command: sh -c "rm -rf /var/www/discovery/assets && cp -r /openedx/discovery/course_discovery/assets/ /var/www/discovery/"
|
||||
|
||||
@ -20,7 +20,7 @@ server {
|
||||
|
||||
# Disables server version feedback on pages and in headers
|
||||
server_tokens off;
|
||||
|
||||
|
||||
client_max_body_size 10m;
|
||||
|
||||
location / {
|
||||
@ -33,11 +33,7 @@ server {
|
||||
proxy_redirect off;
|
||||
proxy_pass http://discovery-backend;
|
||||
}
|
||||
|
||||
location /static {
|
||||
alias /var/www/discovery/assets;
|
||||
}
|
||||
|
||||
|
||||
location /media {
|
||||
alias /var/www/discovery/media;
|
||||
}
|
||||
|
||||
@ -89,5 +89,3 @@ JWT_AUTH["JWT_ISSUERS"] = [
|
||||
EDX_DRF_EXTENSIONS = {
|
||||
'OAUTH2_USER_INFO_URL': '{% if ACTIVATE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/oauth2/user_info',
|
||||
}
|
||||
|
||||
STATIC_ROOT = "/openedx/static"
|
||||
@ -2,6 +2,9 @@ from ..production import *
|
||||
|
||||
{% include "discovery/apps/settings/partials/common.py" %}
|
||||
|
||||
MIDDLEWARE = list(MIDDLEWARE)
|
||||
MIDDLEWARE.insert(0, "whitenoise.middleware.WhiteNoiseMiddleware")
|
||||
|
||||
BACKEND_SERVICE_EDX_OAUTH2_KEY = "{{ DISCOVERY_OAUTH2_KEY }}"
|
||||
BACKEND_SERVICE_EDX_OAUTH2_SECRET = "{{ DISCOVERY_OAUTH2_SECRET }}"
|
||||
BACKEND_SERVICE_EDX_OAUTH2_PROVIDER_URL = "http://lms:8000/oauth2"
|
||||
|
||||
@ -29,6 +29,9 @@ RUN pip install nodeenv
|
||||
RUN nodeenv /openedx/nodeenv --node=12.13.0 --prebuilt
|
||||
ENV PATH /openedx/nodeenv/bin:${PATH}
|
||||
|
||||
# Install whitenoise for serving static assets
|
||||
RUN pip install "whitenoise==5.1.0"
|
||||
|
||||
# Install python and nodejs requirements
|
||||
# This is identical to "make production-requirements" but it was split in multiple
|
||||
# instructions to benefit from docker image caching
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user