[Answered ]-Django MEDIA_ROOT, MEDIA_URL etc

2👍

As per the documentation

MEDIA_ROOT is the Absolute filesystem path to the directory that will hold user-uploaded files.

Your code that pushes the uploaded Images to the root should have settings.MEDIA_ROOT/<sub-folder> instead of settings.MEDIA_URL

MEDIA_URL on the other hand is a placeholder for the url a client should hit to access your media. This is useful when you don’t want to keep your media on your local filesystem, but to an external storage like amazon s3.

Using {{MEDIA_URL}} in your templates gives you a good way of not hard-coding the eventual media location.

👤srj

0👍

first of all in the settings.py MEDIA_URL must be like this:

MEDIA_URL = "/media/"

Then delete MEDIA folder. Only media folder is enough.
and also if you need thumbnails for your uploaded images you can use Django easy_thumbnails package for this

Leave a comment