Sunday, October 13, 2019

Re: Managing links on static files from a static file

Добрый день.

Сделал столбец продуктов и групп репортеров и партнеров при запросе. Также сделал, чтобы изначально в пивот выводилась не какая-то ересь. Плюс сразу создаются все фильтры.
Также теперь есть одна кнопка получения данных, которая может исчезнуть (если данные получены), а также меняется ее текст в зависимости от этапа получения данных.
Этапы такие:
1. Запрос наличия данных. Если не все данные есть, об этом будет сообщено в строке ответа сервера, но недостающие задания в очередь скачки не добавятся.
2. Добавление данных в очередь. Если не все данные есть, и не на все данные есть уже задания в очереди, то они в очередь будут добавлены.
3. Запрос данных с учетом того, что на них на все уже есть задания в очереди, но очередь еще могла не обработаться.
Если при первом запросе данные покрыты уже существующими запросами, но часть из них не обработана и в очереди, то следующим будет сразу пункт 3.
При изменении выбора в первичных фильтрах эти этапы сбрасываются на этап 1.

Пока перехожу к реализации подкодов и зеркальных данных.
Жду фидбек по тестированию.
Если вдруг что-то ломается, будет здорово, если тот, у кого сломалось, запишет четко последовательность действий, которая привела к поломке.

Без вирусов. www.avast.ru

сб, 12 окт. 2019 г. в 14:42, Михаил Брунман <brunman.m@gmail.com>:
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 пользователь Михаил Брунман написал:
Good daytime.
I've spent some time trying to find a solution to my problem, but I still can't.
Here is my problem.
One of my html templates has a link on a javascript file, looking similar to this:
<script type="text/javascript" src='{% static "app_name/script_dir/script_name.js" %}'></script>
The page is returned, when asking the next url:
The mode is Debug, the static is registered and turned on and the script itself is loaded quite successfully.
But the script is a part of a complete project and it contains some references on other .js and .css files from that project, that are also store locally.
And when script is loading and requesting that other files, the server respond with 404 "Not found", because their references are relative and become like this:
instead of
/static/file_relative_path
So is there a way to translate such links from a page-relative link to a static-relative link?


Best wishes, Mikhail

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/FEO0gy37dRw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/eaef703d-da88-4212-8ff5-c0a43f271dd2%40googlegroups.com.


--

_________________________________
С уважением,
Брунман Михаил

Best regards,
Mikhail Brunman

+7 (921) 552-07-98
brunman.m@gmail.com

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK-5vViL47DSf8LWigi6HHj3n%3D1x2ZqB0LxNPjeCwSAt7S0yCw%40mail.gmail.com.

No comments:

Post a Comment