Simply save file to folder in Django

Using default_storage is better than FileSystemStorage.

You can save file to MEDIA_ROOT with FileSystemStorage but when you change DEFAULT_FILE_STORAGE backend in the future this may not work anymore.

If you use default_storage, in the future if you want to use aws, azure etc as file store with multiple Django worker your code will work without any change.

default_storage usage example:

from import default_storage

#  Saving POST'ed file to storage
file = request.FILES['myfile']
file_name =, file)

#  Reading file from storage
file =
file_url = default_storage.url(file_name)

Leave a Comment