Skip to content

Commit

Permalink
Merge pull request #2931 from ambroisie/declarative-media-root
Browse files Browse the repository at this point in the history
add ability to set 'MEDIA_ROOT'
  • Loading branch information
vabene1111 authored Mar 5, 2024
2 parents c23df3d + 857d287 commit 64f5b9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/system/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ This can either be a relative path from the applications base path or the url of
MEDIA_URL=/media/
```

#### Media root

> default `<basedir>/mediafiles` - options `/some/other/media/path`.
Where mediafiles should be stored on disk. The default location is a
`mediafiles` subfolder at the root of the application directory.

#### Gunicorn Workers

> default `3` - options `1-X`
Expand Down
4 changes: 2 additions & 2 deletions recipes/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,10 @@
AWS_S3_CUSTOM_DOMAIN = os.getenv('S3_CUSTOM_DOMAIN', '')

MEDIA_URL = os.getenv('MEDIA_URL', '/media/')
MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles")
MEDIA_ROOT = os.getenv('MEDIA_ROOT', os.path.join(BASE_DIR, "mediafiles"))
else:
MEDIA_URL = os.getenv('MEDIA_URL', '/media/')
MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles")
MEDIA_ROOT = os.getenv('MEDIA_ROOT', os.path.join(BASE_DIR, "mediafiles"))

# Serve static files with gzip
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
Expand Down

0 comments on commit 64f5b9a

Please sign in to comment.