I'm using django and realized that when the filename that the user wants to access (let's say a photo) has the pound sign, the entry in the url.py does not match.
Any ideas?
url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root':
MEDIA_ROOT},
it just says:
"/home/user/project/static/upload/images/hello" does not exist
when actually the name of the file is:
hello#world.jpg
Thanks, Nico
This isn't really Django's fault - the pound (#) sign in a URL means to load the specified anchor on the page. You need to encode the pound sign in your URL to get the browser to request the full image path:
/home/user/project/static/upload/images/hello%23world.jpg
In a Django template you can use the urlencode template tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With