Search code examples
djangoamazon-s3botodjango-settingsdjango-storage

Django - is MEDIA_URL still relevant with S3BotoStorage?


Perhaps a misconception on my part, I don't understand what is the purpose of MEDIA_URL and MEDIA_ROOT when using S3. The files are uploaded to the bucket so the root is never used, and the url of the ImageField is stored inside the image object so the MEDIA_URL is never used either. Is this correct? If not, please explain it so I can better understand how everything fits together.

My setup has three buckets:

static for js, css, templates, set as STATICFILES_STORAGE

media for user uploaded images, set as DEFAULT_FILE_STORAGE

spider for images scraped from other websites.


Solution

  • Given that you are using django-storages, you can safely remove these two variables from your settings.py file.

    Both variables are used for when you are handling media files on the server itself.