New media files not found at django website hosted on azure

A Django website works correctly both locally and on PROD. PROD is azure app service. Since it's deployed to a temporary storage (container, I presume), which is overriden with each deploy, I don't want media files to be overriden every time. So I've moved them to the media folder outside of deployed website folder, but it's inside site/wwwroot, so that I can use it via ftp as well. And those files that where already in the folder site/wwwroot/media, are working fine. But new ones return 404 error on attempt to read them. I've checked and those new files exist and they are exactly in the same folder as old images. I've double checked and tried the same url from the old image, copy-pasted new image file name from ftp on PROD and pasted it into the browser, but it still gives me 404 error.

So for some weird reason website can access file system to read and write, but on attempt to open in browser any image file that was uploded after deploy, it fails.

It feels like it's just remembering a list of files there and doesn't even check if actual file exists if it wasn't there on deploy.

For registering media folder in a project url.py I have this code:

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

I thought that restarting website via azure would make it work, even though it would be a crutchy solution. But it didn't work.

Any thoughts on this one? How to fix it?

Вернуться на верх