[Fixed]-How to download an image from Django

1๐Ÿ‘

โœ…

If the file is placed in settings.MEDIA_ROOT then it is publicly available and you can use settings.MEDIA_URL to create a link.

If the file is outside of settings.MEDIA_ROOT, you can use built-in view django.views.static.serve.

If you need some protection, just use standard view but return FileResponse.

Serving large files through Django is not efficient. If you need large files, check django-sendfile.

๐Ÿ‘คBruce

Leave a comment