Search code examples
djangopinax

What is the difference between media and site_media folders?


What is the difference between the two folders? I created an example project in Pinax and sometimes they put stuff in media and other times site_media.


Solution

  • I believe MEDIA Is used for uploaded files while site_media is for static files.

    https://docs.djangoproject.com/en/dev/topics/files/

    Although the following quote is about staticfiles I think it covers the difference:

    In previous versions of Django, it was common to place static assets in MEDIA_ROOT along with user-uploaded files, and serve them both at MEDIA_URL. Part of the purpose of introducing the staticfiles app is to make it easier to keep static files separate from user-uploaded files.

    For this reason, you need to make your MEDIA_ROOT and MEDIA_URL different from your STATIC_ROOT and STATIC_URL. You will need to arrange for serving of files in MEDIA_ROOT yourself; staticfiles does not deal with user-uploaded files at all. You can, however, use django.views.static.serve() view for serving MEDIA_ROOT in development; see Serving other directories.