Ticket #12323: static_media.diff

File static_media.diff, 2.5 KB (added by nagyv, 5 years ago)
  • django/conf/global_settings.py

     
    236236# Example: "http://media.lawrence.com"
    237237MEDIA_URL = ''
    238238
     239# To differentiate between user uploaded and "really" static content
     240STATIC_ROOT = MEDIA_ROOT
     241STATIC_URL = MEDIA_URL
     242
    239243# List of upload handler classes to be applied in order.
    240244FILE_UPLOAD_HANDLERS = (
    241245    'django.core.files.uploadhandler.MemoryFileUploadHandler',
  • django/forms/widgets.py

     
    7070    def absolute_path(self, path):
    7171        if path.startswith(u'http://') or path.startswith(u'https://') or path.startswith(u'/'):
    7272            return path
    73         return urljoin(settings.MEDIA_URL,path)
     73        return urljoin(settings.STATIC_URL,path)
    7474
    7575    def __getitem__(self, name):
    7676        "Returns a Media object that only contains media of the given type"
  • django/core/context_processors.py

     
    6464    Adds media-related context variables to the context.
    6565
    6666    """
    67     return {'MEDIA_URL': settings.MEDIA_URL}
     67    return {'MEDIA_URL': settings.MEDIA_URL,
     68            'STATIC_URL': settings.STATIC_URL}
    6869
    6970def request(request):
    7071    return {'request': request}
  • docs/ref/settings.txt

     
    980980
    981981.. _site framework docs: ../sites/
    982982
     983.. setting:: STATIC_ROOT
     984
     985STATIC_ROOT
     986----------
     987
     988Default: ``MEDIA_ROOT``
     989
     990Absolute path to the directory that holds media for this installation.
     991Example: ``"/home/media/media.lawrence.com/"``
     992See also ``STATIC_URL``, ``MEDIA_ROOT``, ``MEDIA_URL``.
     993
     994.. setting:: STATIC_URL
     995
     996STATIC_URL
     997---------
     998
     999Default: ``MEDIA_URL``
     1000
     1001URL that handles the media served from ``STATIC_ROOT``.
     1002Example: ``"http://static.lawrence.com"``
     1003
     1004Note that this should have a trailing slash if it has a path component.
     1005
     1006Good: ``"http://www.example.com/static/"``
     1007Bad: ``"http://www.example.com/static"``
     1008
     1009See also ``MEDIA_URL``
     1010
    9831011.. setting:: TEMPLATE_CONTEXT_PROCESSORS
    9841012
    9851013TEMPLATE_CONTEXT_PROCESSORS
Back to Top