0

I trying to serve media files to the template but make them inaccessible from url, and the opposite is happening
when i do: http://localhost:8000/media/210000002A.tif

I get prompted to download the files so it is being served when accessing from the address bar
but in the template I have: <img src="{{ MEDIA_URL }}210000002A.tif"/> and it is not working

my dir contains
-project
-app
-media
-static
-template

and i have this is my urls.py

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

and this in my settings.py

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
Mohamed Benkedadra
  • 1,964
  • 3
  • 21
  • 48

1 Answers1

0

SOLVED IT:
the problem was the .tif extension i just used jpg and it works .. !

Mohamed Benkedadra
  • 1,964
  • 3
  • 21
  • 48