Static file serving out of DEBUG mode addressed
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 55s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 4s
All checks were successful
Build containers when image tags change / build-if-image-changed (., web, containers, main container, git.baumann.gr/adebaumann/labhelper) (push) Successful in 55s
Build containers when image tags change / build-if-image-changed (data-loader, loader, initContainers, init-container, git.baumann.gr/adebaumann/labhelper-data-loader) (push) Successful in 4s
This commit is contained in:
@@ -34,6 +34,7 @@ WORKDIR /app
|
|||||||
COPY --chown=appuser:appuser . .
|
COPY --chown=appuser:appuser . .
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
ENV IMAGE_TAG=build
|
||||||
USER appuser
|
USER appuser
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
RUN rm -rvf /app/Dockerfile* \
|
RUN rm -rvf /app/Dockerfile* \
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ metadata:
|
|||||||
namespace: labhelper
|
namespace: labhelper
|
||||||
data:
|
data:
|
||||||
DEBUG: "False"
|
DEBUG: "False"
|
||||||
ALLOWED_HOSTS: "labhelper.adebaumann.com"
|
ALLOWED_HOSTS: "labhelper.adebaumann.com,*"
|
||||||
ALLOWED_CIDR_NETS: "10.0.0.0/16"
|
ALLOWED_CIDR_NETS: "10.0.0.0/16"
|
||||||
LANGUAGE_CODE: "en-us"
|
LANGUAGE_CODE: "en-us"
|
||||||
TIME_ZONE: "UTC"
|
TIME_ZONE: "UTC"
|
||||||
@@ -18,4 +18,4 @@ data:
|
|||||||
LOGIN_REDIRECT_URL: "index"
|
LOGIN_REDIRECT_URL: "index"
|
||||||
LOGOUT_REDIRECT_URL: "login"
|
LOGOUT_REDIRECT_URL: "login"
|
||||||
GUNICORN_OPTS: "--access-logfile -"
|
GUNICORN_OPTS: "--access-logfile -"
|
||||||
IMAGE_TAG: "0.061"
|
IMAGE_TAG: "0.062"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ spec:
|
|||||||
mountPath: /data
|
mountPath: /data
|
||||||
containers:
|
containers:
|
||||||
- name: web
|
- name: web
|
||||||
image: git.baumann.gr/adebaumann/labhelper:0.061
|
image: git.baumann.gr/adebaumann/labhelper:0.062
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8000
|
- containerPort: 8000
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ INSTALLED_APPS = [
|
|||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
@@ -124,6 +125,9 @@ USE_TZ = os.environ.get('USE_TZ', 'True').lower() == 'true'
|
|||||||
STATIC_URL = os.environ.get('STATIC_URL', '/static/')
|
STATIC_URL = os.environ.get('STATIC_URL', '/static/')
|
||||||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||||||
|
|
||||||
|
# WhiteNoise static file serving configuration
|
||||||
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||||
|
|
||||||
# Media files (user uploads)
|
# Media files (user uploads)
|
||||||
MEDIA_URL = os.environ.get('MEDIA_URL', '/media/')
|
MEDIA_URL = os.environ.get('MEDIA_URL', '/media/')
|
||||||
MEDIA_ROOT = BASE_DIR / 'data' / 'media'
|
MEDIA_ROOT = BASE_DIR / 'data' / 'media'
|
||||||
|
|||||||
@@ -62,5 +62,6 @@ urlpatterns = [
|
|||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
# Static files are served by WhiteNoise middleware in production
|
||||||
|
# Media files still need Django serving in all environments
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|||||||
@@ -36,3 +36,4 @@ Pillow==11.1.0
|
|||||||
sorl-thumbnail==12.11.0
|
sorl-thumbnail==12.11.0
|
||||||
bleach==6.1.0
|
bleach==6.1.0
|
||||||
coverage==7.6.1
|
coverage==7.6.1
|
||||||
|
whitenoise==6.8.2
|
||||||
|
|||||||
Reference in New Issue
Block a user