I've found the solution (if anyone ever will be in need).
There are 2 situations:
1. Development.
For development this problem can be solved using static function.
Import it in your app's urls.py:
from django.conf.urls.static import static
Then use it there after the urlpatterns list:
if settings.DEBUG:
urlpatterns += static(r'app_name/page_name', document_root=settings.STATIC_ROOT + "/inner_files_directory/")
Here app_name and page_name are same as in my initial message.
This string tells Django, that there is an additional static url pattern and it must be resolved using specified directory.
2. Deploy.
In deploy Django should not process static files. It should be done by a dedicated web server. In my case the server is nginx.
So to process these problematic files i added to the config file (.conf that is placed in /etc/nginx/sites-enabled/) next block:
location /app_name/page_name/inner_files_directory {
alias abs_path_to_the_app/app_name/static/app_name/inner_files_directory;
}
This block is similar to standard static block, but processes requests with url, that doesn't contain 'static', but contain app_name/page_name instead
воскресенье, 8 сентября 2019 г., 21:57:31 UTC+3 пользователь Михаил Брунман написал: