Ticket #29570: staticwarning.patch

File staticwarning.patch, 813 bytes (added by Alejandro Dubrovsky, 6 years ago)
  • django/contrib/staticfiles/utils.py

    diff --git a/django/contrib/staticfiles/utils.py b/django/contrib/staticfiles/utils.py
    index 3d28c90f47..dbab4a68d3 100644
    a b  
    11import fnmatch
    22import os
     3import warnings
    34
    45from django.conf import settings
    56from django.core.exceptions import ImproperlyConfigured
    def check_settings(base_url=None):  
    5657            (settings.MEDIA_ROOT == settings.STATIC_ROOT)):
    5758        raise ImproperlyConfigured("The MEDIA_ROOT and STATIC_ROOT "
    5859                                   "settings must have different values")
     60    if settings.MEDIA_URL and base_url and settings.MEDIA_URL.startswith(base_url):
     61        warnings.warn("The contrib.staticfiles app will not serve media if MEDIA_URL is within STATIC_URL")
Back to Top