Issues

Issue #26 open

Prepend MEDIA_ROOT

Kyle MacFarlane
created an issue

Because of the way the default FileSystemStorage behaves (calls safe_join on paths), feeding it a relative URL will get the MEDIA_ROOT prepended to it.

All the storage backends (s3 doesn't) should probably behave the same way for compatibility.

Comments (6)

  1. Ian Lewis

    MEDIA_ROOT is a setting specific to the FileSystemStorage and shouldn't be used by other storage backends. It isn't used anywhere else in Django except the FileSystemStorage.

    We also already support a base path for the s3boto backend in the location setting.

  2. ryanbagwell

    I worked around this by doing the following:

    from storages.backends.s3boto import S3BotoStorage
    
    class StaticFilesStorage(S3BotoStorage):
        location = 'static'
    
    class MediaStorage(S3BotoStorage):
        location = 'media'
    

    then, in settings.py:

    DEFAULT_FILE_STORAGE = 'path.to.MediaStorage'
    STATICFILES_STORAGE = 'path.to.StaticFilesStorage'
    
  3. Log in to comment