I have a little problem with Django and the way to display images with it. I have a folder, called media and a subfolder called media in media.. yea .. don't judge me. I've uploaded a image to a post module and tried to load image with
<img height="400px" width="400" scr="" alt="Image">
output:
<img height="400px" width="400" scr="/media/media/1_g4XcQbA156OfOKVlMox2Tw.png" alt="Image">
The output is okay, if I enter the link in the searchbar, it can open the image and load it, but the image isn't displayed on the page.
I've tried a lot of things, : - MEDIA_URL and ROOT
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR,'media/')
path('blog/',include('blog.urls')),
path('project/',include('project.urls')),
] + static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)
I've tried to make absolute paths, but still, the image stays hidden.
I thank you in advance and hope you can help me.
Nick 'Iywern' Anthony
Aucun commentaire:
Enregistrer un commentaire