Skip to content

Commit

Permalink
Fix/production static not found (#58)
Browse files Browse the repository at this point in the history
* Fix: 운영 환경에서 static resource 접근 할 때 404 에러가 발생하는 이슈 수정

* Chore: docker context 복사할 때 불필요한 파일들은 복사하지 않도록 ignore 파일 추가
  • Loading branch information
jungmir authored Feb 25, 2025
1 parent b1b83a7 commit 43e310c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*venv*
.vscode
.ruff_cache
.github
.git
.gitignore
.pre-commit-config.yaml
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ COPY . .

RUN pip3 install uv
RUN uv sync
RUN uv run python src/manage.py collectstatic --noinput


FROM python:3.12-slim
Expand Down
5 changes: 5 additions & 0 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = "static/"
STATIC_ROOT = BASE_DIR / "staticfiles"

# Media files (Uploaded files)
MEDIA_URL = "media/"
MEDIA_ROOT = BASE_DIR / "media"

# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
Expand Down

0 comments on commit 43e310c

Please sign in to comment.