I have Django app which I test on my local PC and then when I add something new, I upload changes to my company virtual server. I have a problem with links to files. Below is the code for links to attached files (both my local and server have the same code):
<p class="article-content mt-2 mb-1"><strong>Attachment: </strong><a href="{{post.file_close.url}}">{{post.file_close.name}}</a></p>
If I upload file cars.png
everything works fine in both versions. This works no matter the extension, pdf, excel, image, etc.
Problem is, if I upload file carsčč.png
it fails only on server side, on my PC it works great.
I get the following error on my Django/debugg:
Page not found (404)
“C:inetpubfilesPyWebmediaPN_files2022 3 6cars” does not exist
Like the link is not complete, it stopped as soon as it runs into a special character.
But, shown link still containes all the letters, it’s PN_files/2022/03/06/carsčč.png
Tried:
I looked at regional settings, it’s the same on both PCs. Is there something else I could check or change? Maybe include something in the link?
Also, when I manually search for the file, the name is not currupted, it’s saved localy as carsčč.png
. So I guess it’s only the link, tring to get the file.
I figured out it’s because of diacritic letters. On my ‘base.html’ I have meta charset="utf-8"
. Django setting LANGUAGE_CODE = 'hr-BA'
.
I use Bootstrap 4.0 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">