Skip to content

Commit e78f599

Browse files
committed
fix whitenoise
1 parent 8b3ac72 commit e78f599

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ COPY . .
1313
RUN npm run build
1414

1515
# Keep only static build artifacts to reduce image size
16-
RUN rm -rf node_modules package*.json apecs/*/static/*
16+
RUN rm -rf node_modules package*.json
1717

1818
# ------------------ STAGE 2: Python / Django ------------------
1919
FROM python:3.13-slim AS python
@@ -36,7 +36,7 @@ ENV PATH="$POETRY_HOME/bin:$PATH"
3636
RUN curl -sSL https://install.python-poetry.org | python3 -
3737

3838
# ------------------ Copy Node build artifacts first ------------------
39-
COPY --from=static --chown=apecsuser /usr/src/apecs/apecs/*/static ./apecs/
39+
COPY --from=static --chown=apecsuser /usr/src/apecs/apecs/static ./apecs/static/
4040

4141
# Copy project metadata and install Python dependencies
4242
COPY pyproject.toml poetry.lock ./

apecs/settings/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
MEDIA_ROOT = BASE_DIR / 'mediafiles'
171171

172172
STATIC_ROOT = os.path.join(BASE_DIR, 'static/whitenoise')
173-
STATIC_URL = 'static/'
173+
STATIC_URL = '/static/'
174174
STATICFILES_DIRS = [BASE_DIR / "static/dist"]
175175

176176
# Default primary key field type

apecs/wsgi.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
"""
2-
WSGI config for apecs project.
3-
4-
It exposes the WSGI callable as a module-level variable named ``application``.
5-
6-
For more information on this file, see
7-
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/
8-
"""
9-
101
import os
11-
122
from django.core.wsgi import get_wsgi_application
3+
from whitenoise import WhiteNoise
134

145
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apecs.settings.dev')
156

167
application = get_wsgi_application()
8+
9+
STATIC_ROOT = os.path.join(os.path.dirname(__file__), 'static/whitenoise')
10+
application = WhiteNoise(application, root=STATIC_ROOT)

0 commit comments

Comments
 (0)