Find more articles in our new Python Knowledge Base

Same value for MEDIA_ROOT and STATIC_ROOT

According to Django’s documentation, MEDIA_ROOT and STATIC_ROOT must have different values. Before STATIC_ROOT was introduced, MEDIA_ROOT was also used (as fallback) to also serve static files. As this can have serious security implications, Django has validation checks to prevent it.


MEDIA_ROOT and STATIC_ROOT point to the same folder.

""" """

# Media and static root are identical
STATIC_ROOT = '/path/to/my/static/files'
MEDIA_ROOT = '/path/to/my/static/files'

Best practice

Ensure, STATIC_ROOT and MEDIA_ROOT point to different folders.

""" """

STATIC_ROOT = '/path/to/my/static/files'
MEDIA_ROOT = '/path/to/my/media/files'