Handle media files.
This commit is contained in:
parent
9576202fa1
commit
2b9dbcbb2d
4 changed files with 15 additions and 1 deletions
|
@ -7,6 +7,7 @@ services:
|
|||
volumes:
|
||||
- ./wedding_site/:/usr/src/app/
|
||||
- static_volume:/staticfiles
|
||||
- media_volume:/mediafiles
|
||||
expose:
|
||||
- 8000
|
||||
env_file:
|
||||
|
@ -18,8 +19,10 @@ services:
|
|||
- 8080:80
|
||||
volumes:
|
||||
- static_volume:/staticfiles
|
||||
- media_volume:/mediafiles
|
||||
depends_on:
|
||||
- web
|
||||
|
||||
volumes:
|
||||
static_volume:
|
||||
static_volume:
|
||||
media_volume:
|
|
@ -11,10 +11,15 @@ server {
|
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /staticfiles/;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias /mediafiles/;
|
||||
}
|
||||
|
||||
}
|
|
@ -11,6 +11,9 @@ COPY ./requirements.txt .
|
|||
RUN pip install -r requirements.txt
|
||||
|
||||
RUN mkdir staticfiles
|
||||
RUN mkdir mediafiles
|
||||
|
||||
ADD ./uploads /mediafiles
|
||||
|
||||
# copy project
|
||||
COPY . .
|
|
@ -118,6 +118,9 @@ USE_TZ = True
|
|||
STATIC_URL = 'static/'
|
||||
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||
|
||||
MEDIA_URL = 'media/'
|
||||
MEDIA_ROOT = BASE_DIR / "mediafiles"
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
|
||||
|
||||
|
|
Loading…
Reference in a new issue