Serving media and static files directories #5785
Unanswered
MichelGhaith
asked this question in
Q&A
Replies: 1 comment
-
STATIC files are part of your application’s assets (CSS, JS, shared images),but they are shared across all apps. Django collects all static files from every appinto one central folder (via collectstatic) so the web server can serve them efficiently.That’s why STATIC_ROOT is outside APPS_DIR — it’s a single unified location.STATIC_URL = '/static/' MEDIA FILESMEDIA files are user-generated content, often tied to a particular app.For example, a profile_picture uploaded in the accounts app belongs specifically to that app.Storing MEDIA inside APPS_DIR keeps uploaded content organized and logically linked to the app that owns it.MEDIA_URL = '/media/' Summary:STATIC = project-wide, shared assets → outside APPS_DIRMEDIA = app-specific, user content → inside APPS_DIRExample directory structure""" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Why the directory of static files is outside APPS_DIR directory while media directory is within APPS_DIR ?
Beta Was this translation helpful? Give feedback.
All reactions