Monday, June 18, 2018

Media files

Hey everyone. New to Django here i apologize is this question is already answered somewhere.

So i have read the FileField docs and 50 times. I have defined my MEDIA_URL and MEDIA_ROOT. When i upload an image through the admin, i can see the file goes where i directed it to inside of Django. If i try and go into admin, to the user that uploaded the image and click the link to open it, i get an error saying the ID doesn't exist, maybe i deleted it?
I searched the internet up and down until i found the solution. I had to map a URL to urls.py to open it. My problem is i have zero understanding why. Like I've mentioned i tried finding anything about having to MAP the url to my image and can't find documentation. Can anyone explain what I've done wrong? Or where this is at in the docs? It's not in the field models that's for sure.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/da387db3-b5a0-4e7c-9f5f-e88df9b46465%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment