2👍
✅
You should separate media files from static files. Media are for user-uploaded files, and static are for developer-provided files (usually styles and scripts). MEDIA_ROOT
and STATIC_ROOT
should point to different directories. You run collectstatic
to copy all static files from Your source code and various apps (also third-party) to STATIC_ROOT
, so Apache can serve them. You don’t need to run collectstatic
and anything special to serve Your media files.
Example config:
Alias /static/ C:/Users/Robin/static/
Alias /media/ C:/Users/Robin/media/
<Directory C:/Users/Robin/static>
Order deny,allow
Allow from all
</Directory>
<Directory C:/Users/Robin/media>
Order deny,allow
Allow from all
</Directory>
Source:stackexchange.com