Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello I am working on a Social Media Page where Users can upload Images.

The uploaded Files are in my BLOG Folder, where also my Feed.html is placed where the Content is displayed.

But I want to show the uploaded Files to my Profile.hmtl as well, the File is on the USERS Folder.

For example:

<img class="image-style" src="{{ post.file.url }}">


this is the code that shows the Image Content, but when I use this on my /USERS/Profile.html it doesn't show the content, because the url is on the BLOG Folder, how can I adjust the code to get the information from the Blog Folder?

Thank you for every Answer.

What I have tried:

I tried something like:

<img class="image-style" src="{{ ../blog/post.file.url }}">


but that of course didn't work.

I tried to get the views.py and urls.py from USERS to BLOG but it just mixes up everything and doesn't work well.

I also got Comments by People saying that i should make the uploaded files Static, but that doesn't work because the Images are uploaded to a database.
Posted
Updated 23-Jul-23 5:45am
v2
Comments
Richard Deeming 24-Jul-23 7:38am    
REPOST
The answer hasn't changed since you posted exactly the same question last week:
How to reffer to a ploaded file from antoher folder? Django, Python[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900