Home > Mobile >  How to get Image From Media Folder in Django
How to get Image From Media Folder in Django

Time:05-18

I uplaoded An image from fontend to media folder in django. How can I get that image inside my view.py file. so that I can process that image. image is saved in /media/images folder

 INPUT_IMAGE = '../media/images/inp7.jpg'

but when I try to get image using this url its showing file not found. How can I fix it.

CodePudding user response:

in Django 3.2:

    from django.conf import settings
    
    INPUT_IMAGE = settings.MEDIA_ROOT / 'inp7.jpg'

please check your MEDIA_ROOT in settings.py and confirm the value is BASE_ROOT / "

  • Related