why is image not displaying on my django user profile project but saved to profile_pics in media directory

52 Views Asked by At

i am working on a django project. i am having problem with my image displaying on the my user profile. when i inspect the html the part was correct and image was in the diectory. i still can't dispay the image. i am getting Not Found: /media/profile_pics/samvicom_zjHwtga.jpg [31/May/2023 05:20:58] ?[33m"GET /media/profile_pics/samvicom_zjHwtga.jpg HTTP/1.1" 404 3055?[0m

i tried to display user profile picture but i am getting an error on my terminal. here is the error i got Not Found: /media/profile_pics/samvicom_zjHwtga.jpg [31/May/2023 05:20:58] ?[33m"GET /media/profile_pics/samvicom_zjHwtga.jpg HTTP/1.1" 404 3055?[0m

Bellow is my code on GitHub https://github.com/flameloaded/django-blog

1

There are 1 best solutions below

0
Kotteeswaran B On

Hey dood everything is fine and good expect one. In urls file you haven't configured the correct media route to the pattern.

In urls.py file:- urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) By mistake you have configured like STATIC_URL which is not present in the settings file. That's the only change. Have a great day folks!