{"id":311434,"date":"2020-10-14T09:00:40","date_gmt":"2020-10-14T09:00:40","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=311434"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=311434","title":{"rendered":"\u041b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e Django"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/barsgroup\/blog\/523068\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/da\/m5\/sv\/dam5svl0yybrq3pzb8tjwkjrnkw.jpeg\"><\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0414\u043c\u0438\u0442\u0440\u0438\u0439 \u0427\u0435\u0440\u043d\u044b\u0448\u043e\u0432, \u044f \u0432\u0435\u0434\u0443\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u00ab\u0411\u0410\u0420\u0421 \u0413\u0440\u0443\u043f\u00bb. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u0441\u0440\u0435\u0434\u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430\u043c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Django \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f\u043c\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0443 \u043d\u0430\u0441 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b. <\/p>\n<h3>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f\/\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h3>\n<p>  \u0412 Django \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b:<\/p>\n<ul>\n<li>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439?<\/li>\n<li>\u041a\u0430\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e?<\/li>\n<li>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0421\u0423\u0411\u0414?<\/li>\n<li>\u0412 \u043a\u0430\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0441\u0430\u043c\u044b\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438?<\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0414\u0435\u043c\u043e-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 <a href=\"https:\/\/docs.djangoproject.com\/en\/3.0\/intro\/install\/\">\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Django 3<\/a> \u0432\u0435\u0440\u0441\u0438\u0438 \u0438 <a href=\"https:\/\/docs.djangoproject.com\/en\/3.0\/intro\/tutorial01\/\">\u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a> (\u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e). \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0421\u0423\u0411\u0414 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>PostgreSQL<\/b>. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0445\u043e\u0447\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043d\u0443\u043b\u044f \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <a href=\"https:\/\/github.com\/babayko\/django-request\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043c\u0435\u0442\u043a\u0430 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c diff \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439\/\u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043c\u0435\u0442\u043a\u043e\u0439. \u0411\u0430\u0437\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043f\u043e \u043c\u0435\u0442\u043a\u0435 <b>stage_00<\/b>.<\/p>\n<h3>\u041b\u043e\u0433\u0438\u0440\u0443\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/h3>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443: \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0427\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c? \u0412 Django \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/docs.djangoproject.com\/en\/3.0\/topics\/http\/middleware\/\">middleware<\/a>. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u2014 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u043a\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043f\u0430\u0434\u0435\u0442 \u0432\u043e view (\u0438 \u043d\u0438\u0436\u0435\u0441\u0442\u043e\u044f\u0449\u0438\u0435 middleware), \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0443. \u041a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u043c \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c? \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u0442\u043c\u0435\u0442\u043a\u0443, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438\u0434\u0435\u0442 \u043a \u043d\u0430\u043c, \u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u2014 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0438 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u043c\u0435\u0442\u043a\u043e\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0442\u0430\u043a\u043e\u0439 middleware:<\/p>\n<p>  <b>polls\/middleware.py<\/b>  <\/p>\n<pre><code class=\"python\">import time   class RequestTimeMiddleware:    def __init__(self, get_response):        self.get_response = get_response     def __call__(self, request):        timestamp = time.monotonic()         response = self.get_response(request)         print(            f'\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 {request.path} - '            f'{time.monotonic() - timestamp:.3f} \u0441\u0435\u043a.'        )         return response<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 middleware \u0432 settings.py:<\/p>\n<p>  <b>mysite\/settings.py<\/b>  <\/p>\n<pre><code class=\"python\"># ...  MIDDLEWARE = [     'polls.middleware.RequestTimeMiddleware',     'django.middleware.security.SecurityMiddleware',     'django.contrib.sessions.middleware.SessionMiddleware',     # ...    ]<\/code><\/pre>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043d\u0430\u0448 middleware \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0448\u0435 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 (\u0432 \u0438\u0434\u0435\u0430\u043b\u0435, \u043f\u0435\u0440\u0432\u044b\u043c), \u0447\u0442\u043e\u0431\u044b \u0432 \u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b view, \u043d\u043e \u0438 \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 middleware. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0430\u0434\u043c\u0438\u043d-\u043f\u0430\u043d\u0435\u043b\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/127.0.0.1:8000\/admin\">http:\/\/127.0.0.1:8000\/admin\/<\/a>. \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u0441\u044f \u0432\u044b\u0432\u043e\u0434, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043d\u0438\u0436\u0435:<\/p>\n<pre><code class=\"django\">Performing system checks...  System check identified no issues (0 silenced). June 23, 2020 - 21:21:56 Django version 3.0.7, using settings 'mysite.settings' Starting development server at http:\/\/127.0.0.1:8000\/ Quit the server with CONTROL-C. [23\/Jun\/2020 21:22:01] &quot;GET \/admin\/ HTTP\/1.1&quot; 200 3721 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/ - 0.036 \u0441\u0435\u043a. [23\/Jun\/2020 21:22:01] &quot;GET \/static\/admin\/css\/base.css HTTP\/1.1&quot; 304 0 [23\/Jun\/2020 21:22:01] &quot;GET \/static\/admin\/css\/dashboard.css HTTP\/1.1&quot; 304 0 [23\/Jun\/2020 21:22:01] &quot;GET \/static\/admin\/css\/responsive.css HTTP\/1.1&quot; 304 0 [23\/Jun\/2020 21:22:03] &quot;GET \/admin\/ HTTP\/1.1&quot; 200 3721 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/ - 0.021 \u0441\u0435\u043a. <\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u043c\u0435\u0442\u043a\u0435 <b>stage_01<\/b>.<\/p>\n<h3>\u041e\u0442\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442 \u0421\u0423\u0411\u0414<\/h3>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f python-\u043a\u043e\u0434\u0430, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a \u0421\u0423\u0411\u0414. \u0411\u044b\u043b\u043e \u0431\u044b \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f python-\u043a\u043e\u0434\u0430 \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0421\u0423\u0411\u0414. \u0427\u0442\u043e \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Django? \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0421\u0423\u0411\u0414 Django \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c <a href=\"https:\/\/docs.djangoproject.com\/en\/3.0\/ref\/databases\/\">engine<\/a>. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <a href=\"https:\/\/docs.djangoproject.com\/en\/3.0\/ref\/databases\/#subclassing-the-built-in-database-backends\">\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e engine<\/a>. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 CursorWrapper \u0438 \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u043d\u0430\u0448\u0438 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 <i>base.py<\/i>:<\/p>\n<p>  <b>polls\/base.py<\/b>  <\/p>\n<pre><code class=\"python\">import time from contextlib import contextmanager  from django.db.backends.postgresql.base import DatabaseWrapper as DjangoDatabaseWrapper from django.db.backends.utils import CursorWrapper as DjangoCursorWrapper   @contextmanager def calc_sql_time(sql):    timestamp = time.monotonic()     yield   print(        f'\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 {sql} - '        f'{time.monotonic() - timestamp:.3f} \u0441\u0435\u043a.'    )   class CursorWrapper(DjangoCursorWrapper):    def execute(self, sql, params=None):        with calc_sql_time(sql):            return super().execute(sql, params)   class DatabaseWrapper(DjangoDatabaseWrapper):    def create_cursor(self, name=None):        cursor = super().create_cursor(name)        return CursorWrapper(cursor, self) <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u0430\u0448 engine, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u0432<i> settings.py<\/i>:<\/p>\n<p>  <b>mysite\/settings.py<\/b>  <\/p>\n<pre><code class=\"python\"># ...  DATABASES = {    'default': {        'ENGINE': 'polls',        'NAME': 'mysite',        'USER': 'postgres',        'PASSWORD': 'postgres',    } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<pre><code class=\"django\">[29\/Jun\/2020 11:41:05] &quot;GET \/admin\/ HTTP\/1.1&quot; 200 3721 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 SELECT &quot;django_session&quot;.&quot;session_key&quot;, &quot;django_session&quot;.&quot;session_data&quot;, &quot;django_session&quot;.&quot;expire_date&quot; FROM &quot;django_session&quot; WHERE (&quot;django_session&quot;.&quot;expire_date&quot; &gt; %s AND &quot;django_session&quot;.&quot;session_key&quot; = %s) LIMIT 21 - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 SELECT &quot;auth_user&quot;.&quot;id&quot;, &quot;auth_user&quot;.&quot;password&quot;, &quot;auth_user&quot;.&quot;last_login&quot;, &quot;auth_user&quot;.&quot;is_superuser&quot;, &quot;auth_user&quot;.&quot;username&quot;, &quot;auth_user&quot;.&quot;first_name&quot;, &quot;auth_user&quot;.&quot;last_name&quot;, &quot;auth_user&quot;.&quot;email&quot;, &quot;auth_user&quot;.&quot;is_staff&quot;, &quot;auth_user&quot;.&quot;is_active&quot;, &quot;auth_user&quot;.&quot;date_joined&quot; FROM &quot;auth_user&quot; WHERE &quot;auth_user&quot;.&quot;id&quot; = %s LIMIT 21 - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 SELECT COUNT(*) AS &quot;__count&quot; FROM &quot;polls_question&quot; - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 SELECT COUNT(*) AS &quot;__count&quot; FROM &quot;polls_question&quot; - 0.000 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 SELECT &quot;polls_question&quot;.&quot;id&quot;, &quot;polls_question&quot;.&quot;question_text&quot;, &quot;polls_question&quot;.&quot;pub_date&quot; FROM &quot;polls_question&quot; ORDER BY &quot;polls_question&quot;.&quot;id&quot; DESC - 0.000 \u0441\u0435\u043a. [29\/Jun\/2020 11:41:09] &quot;GET \/admin\/polls\/question\/ HTTP\/1.1&quot; 200 3179 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/polls\/question\/ - 0.034 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 SELECT &quot;django_session&quot;.&quot;session_key&quot;, &quot;django_session&quot;.&quot;session_data&quot;, &quot;django_session&quot;.&quot;expire_date&quot; FROM &quot;django_session&quot; WHERE (&quot;django_session&quot;.&quot;expire_date&quot; &gt; %s AND &quot;django_session&quot;.&quot;session_key&quot; = %s) LIMIT 21 - 0.002 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 SELECT &quot;auth_user&quot;.&quot;id&quot;, &quot;auth_user&quot;.&quot;password&quot;, &quot;auth_user&quot;.&quot;last_login&quot;, &quot;auth_user&quot;.&quot;is_superuser&quot;, &quot;auth_user&quot;.&quot;username&quot;, &quot;auth_user&quot;.&quot;first_name&quot;, &quot;auth_user&quot;.&quot;last_name&quot;, &quot;auth_user&quot;.&quot;email&quot;, &quot;auth_user&quot;.&quot;is_staff&quot;, &quot;auth_user&quot;.&quot;is_active&quot;, &quot;auth_user&quot;.&quot;date_joined&quot; FROM &quot;auth_user&quot; WHERE &quot;auth_user&quot;.&quot;id&quot; = %s LIMIT 21 - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/jsi18n\/ - 0.012 \u0441\u0435\u043a. [29\/Jun\/2020 11:41:10] &quot;GET \/admin\/jsi18n\/ HTTP\/1.1&quot; 200 3223<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u043c\u0435\u0442\u043a\u0435 <b>stage_02<\/b>.<\/p>\n<h3>\u0421\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0411\u0414 \u0438 web-\u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/h3>\n<p>  \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0411\u0414 \u0431\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 SQL-\u0437\u0430\u043f\u0440\u043e\u0441. \u042d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 middleware \u0438 \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c middleware, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 path \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<p>  <b>polls\/middleware.py<\/b>  <\/p>\n<pre><code class=\"python\">import time from threading import local   thread_locals = local()   class RequestTimeMiddleware:    def __init__(self, get_response):        self.get_response = get_response   def __call__(self, request):        thread_locals.path = request.path        timestamp = time.monotonic()         response = self.get_response(request)         print(            f'\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 {request.path} - '            f'{time.monotonic() - timestamp:.3f} \u0441\u0435\u043a.'        )        thread_locals.path = ''         return response <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043a \u0437\u0430\u043f\u0440\u043e\u0441\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0443\u0440\u0441\u043e\u0440\u0435:<\/p>\n<p>  <b>polls\/base.py<\/b>  <\/p>\n<pre><code class=\"python\">from django.utils.encoding import force_text  from polls.middleware import thread_locals  # ...   def make_safe(s):    return s.replace('*', '').replace('\\\\', '').replace('%', '')   class CursorWrapper(DjangoCursorWrapper):    def execute(self, sql, params=None):        path = getattr(thread_locals, 'path', '')        if path:            path = make_safe(path)            sql = f'\/* {path} *\/\\n{force_text(sql)}\\n\/* {path} *\/'         with calc_sql_time(sql):            return super().execute(sql, params)<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043b\u043e\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"django\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT &quot;django_session&quot;.&quot;session_key&quot;, &quot;django_session&quot;.&quot;session_data&quot;, &quot;django_session&quot;.&quot;expire_date&quot; FROM &quot;django_session&quot; WHERE (&quot;django_session&quot;.&quot;expire_date&quot; &gt; %s AND &quot;django_session&quot;.&quot;session_key&quot; = %s) LIMIT 21 \/* \/admin\/auth\/user\/ *\/ - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT &quot;auth_user&quot;.&quot;id&quot;, &quot;auth_user&quot;.&quot;password&quot;, &quot;auth_user&quot;.&quot;last_login&quot;, &quot;auth_user&quot;.&quot;is_superuser&quot;, &quot;auth_user&quot;.&quot;username&quot;, &quot;auth_user&quot;.&quot;first_name&quot;, &quot;auth_user&quot;.&quot;last_name&quot;, &quot;auth_user&quot;.&quot;email&quot;, &quot;auth_user&quot;.&quot;is_staff&quot;, &quot;auth_user&quot;.&quot;is_active&quot;, &quot;auth_user&quot;.&quot;date_joined&quot; FROM &quot;auth_user&quot; WHERE &quot;auth_user&quot;.&quot;id&quot; = %s LIMIT 21 \/* \/admin\/auth\/user\/ *\/ - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT &quot;auth_group&quot;.&quot;id&quot;, &quot;auth_group&quot;.&quot;name&quot; FROM &quot;auth_group&quot; ORDER BY &quot;auth_group&quot;.&quot;name&quot; ASC \/* \/admin\/auth\/user\/ *\/ - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT COUNT(*) AS &quot;__count&quot; FROM &quot;auth_user&quot; \/* \/admin\/auth\/user\/ *\/ - 0.000 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT COUNT(*) AS &quot;__count&quot; FROM &quot;auth_user&quot; \/* \/admin\/auth\/user\/ *\/ - 0.000 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT &quot;auth_user&quot;.&quot;id&quot;, &quot;auth_user&quot;.&quot;password&quot;, &quot;auth_user&quot;.&quot;last_login&quot;, &quot;auth_user&quot;.&quot;is_superuser&quot;, &quot;auth_user&quot;.&quot;username&quot;, &quot;auth_user&quot;.&quot;first_name&quot;, &quot;auth_user&quot;.&quot;last_name&quot;, &quot;auth_user&quot;.&quot;email&quot;, &quot;auth_user&quot;.&quot;is_staff&quot;, &quot;auth_user&quot;.&quot;is_active&quot;, &quot;auth_user&quot;.&quot;date_joined&quot; FROM &quot;auth_user&quot; ORDER BY &quot;auth_user&quot;.&quot;username&quot; ASC \/* \/admin\/auth\/user\/ *\/ - 0.000 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/auth\/user\/ - 0.071 \u0441\u0435\u043a. [29\/Jun\/2020 12:19:15] &quot;GET \/admin\/auth\/user\/ HTTP\/1.1&quot; 200 6608 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/jsi18n\/ *\/ SELECT &quot;django_session&quot;.&quot;session_key&quot;, &quot;django_session&quot;.&quot;session_data&quot;, &quot;django_session&quot;.&quot;expire_date&quot; FROM &quot;django_session&quot; WHERE (&quot;django_session&quot;.&quot;expire_date&quot; &gt; %s AND &quot;django_session&quot;.&quot;session_key&quot; = %s) LIMIT 21 \/* \/admin\/jsi18n\/ *\/ - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/jsi18n\/ *\/ SELECT &quot;auth_user&quot;.&quot;id&quot;, &quot;auth_user&quot;.&quot;password&quot;, &quot;auth_user&quot;.&quot;last_login&quot;, &quot;auth_user&quot;.&quot;is_superuser&quot;, &quot;auth_user&quot;.&quot;username&quot;, &quot;auth_user&quot;.&quot;first_name&quot;, &quot;auth_user&quot;.&quot;last_name&quot;, &quot;auth_user&quot;.&quot;email&quot;, &quot;auth_user&quot;.&quot;is_staff&quot;, &quot;auth_user&quot;.&quot;is_active&quot;, &quot;auth_user&quot;.&quot;date_joined&quot; FROM &quot;auth_user&quot; WHERE &quot;auth_user&quot;.&quot;id&quot; = %s LIMIT 21 \/* \/admin\/jsi18n\/ *\/ - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/jsi18n\/ - 0.009 \u0441\u0435\u043a. [29\/Jun\/2020 12:19:15] &quot;GET \/admin\/jsi18n\/ HTTP\/1.1&quot; 200 3223 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT &quot;django_session&quot;.&quot;session_key&quot;, &quot;django_session&quot;.&quot;session_data&quot;, &quot;django_session&quot;.&quot;expire_date&quot; FROM &quot;django_session&quot; WHERE (&quot;django_session&quot;.&quot;expire_date&quot; &gt; %s AND &quot;django_session&quot;.&quot;session_key&quot; = %s) LIMIT 21 \/* \/admin\/auth\/user\/ *\/ - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT &quot;auth_user&quot;.&quot;id&quot;, &quot;auth_user&quot;.&quot;password&quot;, &quot;auth_user&quot;.&quot;last_login&quot;, &quot;auth_user&quot;.&quot;is_superuser&quot;, &quot;auth_user&quot;.&quot;username&quot;, &quot;auth_user&quot;.&quot;first_name&quot;, &quot;auth_user&quot;.&quot;last_name&quot;, &quot;auth_user&quot;.&quot;email&quot;, &quot;auth_user&quot;.&quot;is_staff&quot;, &quot;auth_user&quot;.&quot;is_active&quot;, &quot;auth_user&quot;.&quot;date_joined&quot; FROM &quot;auth_user&quot; WHERE &quot;auth_user&quot;.&quot;id&quot; = %s LIMIT 21 \/* \/admin\/auth\/user\/ *\/ - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT &quot;auth_group&quot;.&quot;id&quot;, &quot;auth_group&quot;.&quot;name&quot; FROM &quot;auth_group&quot; ORDER BY &quot;auth_group&quot;.&quot;name&quot; ASC \/* \/admin\/auth\/user\/ *\/ - 0.000 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT COUNT(*) AS &quot;__count&quot; FROM &quot;auth_user&quot; \/* \/admin\/auth\/user\/ *\/ - 0.000 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT COUNT(*) AS &quot;__count&quot; FROM &quot;auth_user&quot; \/* \/admin\/auth\/user\/ *\/ - 0.000 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/auth\/user\/ *\/ SELECT &quot;auth_user&quot;.&quot;id&quot;, &quot;auth_user&quot;.&quot;password&quot;, &quot;auth_user&quot;.&quot;last_login&quot;, &quot;auth_user&quot;.&quot;is_superuser&quot;, &quot;auth_user&quot;.&quot;username&quot;, &quot;auth_user&quot;.&quot;first_name&quot;, &quot;auth_user&quot;.&quot;last_name&quot;, &quot;auth_user&quot;.&quot;email&quot;, &quot;auth_user&quot;.&quot;is_staff&quot;, &quot;auth_user&quot;.&quot;is_active&quot;, &quot;auth_user&quot;.&quot;date_joined&quot; FROM &quot;auth_user&quot; ORDER BY &quot;auth_user&quot;.&quot;username&quot; ASC \/* \/admin\/auth\/user\/ *\/ - 0.000 \u0441\u0435\u043a. [29\/Jun\/2020 12:19:18] &quot;GET \/admin\/auth\/user\/ HTTP\/1.1&quot; 200 6608 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/auth\/user\/ - 0.045 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/jsi18n\/ *\/ SELECT &quot;django_session&quot;.&quot;session_key&quot;, &quot;django_session&quot;.&quot;session_data&quot;, &quot;django_session&quot;.&quot;expire_date&quot; FROM &quot;django_session&quot; WHERE (&quot;django_session&quot;.&quot;expire_date&quot; &gt; %s AND &quot;django_session&quot;.&quot;session_key&quot; = %s) LIMIT 21 \/* \/admin\/jsi18n\/ *\/ - 0.002 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/* \/admin\/jsi18n\/ *\/ SELECT &quot;auth_user&quot;.&quot;id&quot;, &quot;auth_user&quot;.&quot;password&quot;, &quot;auth_user&quot;.&quot;last_login&quot;, &quot;auth_user&quot;.&quot;is_superuser&quot;, &quot;auth_user&quot;.&quot;username&quot;, &quot;auth_user&quot;.&quot;first_name&quot;, &quot;auth_user&quot;.&quot;last_name&quot;, &quot;auth_user&quot;.&quot;email&quot;, &quot;auth_user&quot;.&quot;is_staff&quot;, &quot;auth_user&quot;.&quot;is_active&quot;, &quot;auth_user&quot;.&quot;date_joined&quot; FROM &quot;auth_user&quot; WHERE &quot;auth_user&quot;.&quot;id&quot; = %s LIMIT 21 \/* \/admin\/jsi18n\/ *\/ - 0.001 \u0441\u0435\u043a. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/jsi18n\/ - 0.013 \u0441\u0435\u043a. [29\/Jun\/2020 12:19:19] &quot;GET \/admin\/jsi18n\/ HTTP\/1.1&quot; 200 3223 <\/code><\/pre>\n<p>  \u0413\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u0430\u043b\u0435\u0435? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0442\u0447\u0435\u0442\u0430 <a href=\"https:\/\/github.com\/darold\/pgbadger\">pgBadger<\/a>. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e url, \u043d\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>  \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u043c\u0435\u0442\u043a\u0435 <b>stage_03<\/b>.<\/p>\n<h3>\u041b\u043e\u0433\u0438\u0440\u0443\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e\u0431 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 production, \u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u0437\u044f\u0442\u044b\u0439 SQL-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430\u043c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d. \u0417\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0432\u0430\u0436\u043d\u0435\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0442\u043e\u0433\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. <\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u043d\u0435\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 middleware:<\/p>\n<p>  <b>polls\/middleware.py<\/b>  <\/p>\n<pre><code class=\"python\"># ...  class RequestTimeMiddleware:    # ...     def __call__(self, request):        thread_locals.path = request.path        thread_locals.sql_count = 0        thread_locals.sql_total = 0        timestamp = time.monotonic()         response = self.get_response(request)         print(            f'\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 {request.path} - '            f'{time.monotonic() - timestamp:.3f} \u0441\u0435\u043a. '            f'\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - {thread_locals.sql_count}. '            f'\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - {thread_locals.sql_total:.3f}.'        )         thread_locals.sql_total = 0        thread_locals.sql_count = 0        thread_locals.path = ''         return response<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430:<\/p>\n<p>  <b>polls\/base.py<\/b>  <\/p>\n<pre><code class=\"python\"># ...  @contextmanager def calc_sql_time(sql):    timestamp = time.monotonic()     yield     if hasattr(thread_locals, 'sql_count'):        thread_locals.sql_count += 1        thread_locals.sql_total += time.monotonic() - timestamp<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043b\u043e\u0433 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"django\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/ - 0.041 \u0441\u0435\u043a. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - 3. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - 0.004. [29\/Jun\/2020 13:44:49] &quot;GET \/admin\/ HTTP\/1.1&quot; 200 3721 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/polls\/question\/ - 0.031 \u0441\u0435\u043a. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - 5. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - 0.004. [29\/Jun\/2020 13:44:56] &quot;GET \/admin\/polls\/question\/ HTTP\/1.1&quot; 200 3179 [29\/Jun\/2020 13:44:56] &quot;GET \/static\/admin\/js\/vendor\/jquery\/jquery.js HTTP\/1.1&quot; 200 287630 [29\/Jun\/2020 13:44:56] &quot;GET \/admin\/jsi18n\/ HTTP\/1.1&quot; 200 3223 \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \/admin\/jsi18n\/ - 0.011 \u0441\u0435\u043a. \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - 2. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 - 0.002.<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u0435\u0439\u0441\u0430\u0445 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0442\u0438\u043f\u043e\u0432 (SELECT, INSERT, UPDATE, DELETE)<\/li>\n<li>\u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0442\u0438\u043f\u043e\u0432 <\/li>\n<li>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/li>\n<li>\u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439<\/li>\n<li>\u0430\u043b\u0438\u0430\u0441\u044b \u0431\u0430\u0437\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b (\u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0411\u0414)<\/li>\n<\/ul>\n<p>  \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u043c\u0435\u0442\u043a\u0435<b> stage_04<\/b>.<\/p>\n<h3>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430<\/h3>\n<p>  \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u043d\u0443\u0436\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u0435\u0435 \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u0434\u0445\u043e\u0434 \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0432 \u0444\u0430\u0439\u043b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c middleware:<\/p>\n<p>  <b>polls\/base.py<\/b>  <\/p>\n<pre><code class=\"python\">import json  # ...  class RequestTimeMiddleware:    # ...     def __call__(self, request):        # ...         response = self.get_response(request)         data = {            'path': request.path,            'request_total': round(time.monotonic() - timestamp, 3),            'sql_count': round(thread_locals.sql_count, 3),            'sql_total': round(thread_locals.sql_total, 3),        }         with open('request.log', 'a') as f:            f.write(json.dumps(data) + '\\n')         thread_locals.sql_total = 0        thread_locals.sql_count = 0        thread_locals.path = ''         return response<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 request.log \u0431\u0443\u0434\u0443\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"python\">{&quot;path&quot;: &quot;\/admin\/&quot;, &quot;request_total&quot;: 0.025, &quot;sql_count&quot;: 3, &quot;sql_total&quot;: 0.004} {&quot;path&quot;: &quot;\/admin\/polls\/question\/&quot;, &quot;request_total&quot;: 0.029, &quot;sql_count&quot;: 5, &quot;sql_total&quot;: 0.002} {&quot;path&quot;: &quot;\/admin\/jsi18n\/&quot;, &quot;request_total&quot;: 0.01, &quot;sql_count&quot;: 2, &quot;sql_total&quot;: 0.003} {&quot;path&quot;: &quot;\/admin\/&quot;, &quot;request_total&quot;: 0.027, &quot;sql_count&quot;: 3, &quot;sql_total&quot;: 0.003} {&quot;path&quot;: &quot;\/admin\/auth\/user\/&quot;, &quot;request_total&quot;: 0.047, &quot;sql_count&quot;: 6, &quot;sql_total&quot;: 0.004} {&quot;path&quot;: &quot;\/admin\/jsi18n\/&quot;, &quot;request_total&quot;: 0.011, &quot;sql_count&quot;: 2, &quot;sql_total&quot;: 0.003}<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u043c\u0435\u0442\u043a\u0435<b> stage_05<\/b>.<\/p>\n<h3>\u041b\u043e\u0433\u0438\u0440\u0443\u0435\u043c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 (js)<\/h3>\n<p>  \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c \u0435\u0449\u0435 \u0438 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u043e\u0442\u0432\u0435\u0442\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f SPA. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a XHR-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432:<\/p>\n<p>  <b>polls\/static\/xhr_interceptor.js<\/b>  <\/p>\n<pre><code class=\"python\">'use strict';  \/** * \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 XHR-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 *\/ var XhrInterceptor = {   \/**    * \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 \u043c\u0435\u0442\u043e\u0434\u044b    *\/    addRequestCallback: function (callback) {       \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a \u0437\u0430\u043f\u0440\u043e\u0441\u0443       this.requestCallbacks.push(callback);   },    removeRequestCallback: function (callback) {       \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u0430       this.arrayRemove(this.requestCallbacks, callback);   },    addResponseCallback: function (callback) {       \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a \u043e\u0442\u0432\u0435\u0442\u0443       this.responseCallbacks.push(callback);   },    removeResponseCallback: function (callback) {       \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0442\u0432\u0435\u0442\u0430       this.arrayRemove(this.responseCallbacks, callback);   },    \/**    * \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442 XhrInterceptor \u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 xhr    *\/   wire: function () {       if (this.wired) throw new Error(&quot;Ajax interceptor already wired&quot;);        \/\/ \u041f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432\u0441\u0435\u0445 xhr       XMLHttpRequest.prototype.send = function () {            \/\/ \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e \u0435\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438           XhrInterceptor.fireCallbacks(XhrInterceptor.requestCallbacks, this);            \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u043e\u0432           if (this.addEventListener) {               var xhr = this;               this.addEventListener(&quot;readystatechange&quot;, function () {                   XhrInterceptor.fireResponseCallbacksIfCompleted(xhr);               }, false);           }           else {               XhrInterceptor.proxifyOnReadyStateChange(this);           }            XhrInterceptor.RealXHRSend.apply(this, arguments);       };       this.wired = true;   },    \/**    * \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 XhrInterceptor \u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 xhr    *\/   unwire: function () {       if (!this.wired) throw new Error(&quot;Ajax interceptor not currently wired&quot;);       XMLHttpRequest.prototype.send = this.RealXHRSend;       this.wired = false;   },    isWired: function () {       \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0442\u043e\u0433\u043e, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043b\u0438 XhrInterceptor       return this.wired;   },    \/**    * \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 \u043c\u0435\u0442\u043e\u0434\u044b    *\/   \/\/ \u041d\u0435\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 xhr-\u0437\u0430\u043f\u0440\u043e\u0441\u0430   RealXHRSend: XMLHttpRequest.prototype.send,   \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430   requestCallbacks: [],   \/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u0430   responseCallbacks: [],   \/\/ \u041f\u0440\u0438\u0437\u043d\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435   wired: false,    \/**    * \u0423\u0434\u0430\u043b\u044f\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430    *\/   arrayRemove: function (array, item) {       var index = array.indexOf(item);       if (index &gt; -1) {           array.splice(index, 1);       } else {           throw new Error(&quot;Could not remove &quot; + item + &quot; from array&quot;);       }   },   \/**    * \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438    *\/   fireCallbacks: function (callbacks, xhr) {       for (var i = 0; i &lt; callbacks.length; i++) {           callbacks[i](xhr);       }   },   \/**    * \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u0430, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d    *\/   fireResponseCallbacksIfCompleted: function (xhr) {       if (xhr.readyState === XMLHttpRequest.DONE) {           this.fireCallbacks(this.responseCallbacks, xhr);       }   },   \/**    * \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f,    * \u043a\u043e\u0433\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c listener \u043d\u0435\u043b\u044c\u0437\u044f    *\/   proxifyOnReadyStateChange: function (xhr) {       var realOnReadyStateChange = xhr.onreadystatechange;       if (realOnReadyStateChange) {           xhr.onreadystatechange = function () {               this.fireResponseCallbacksIfCompleted(xhr);               realOnReadyStateChange();           };       }   } }; <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a \u0437\u0430\u043f\u0440\u043e\u0441\u0443:<\/p>\n<p>  <b>polls\/static\/request_client.js<\/b>  <\/p>\n<pre><code class=\"python\">function generate_request_guid() {   function s4() {       return Math.floor((1 + Math.random()) * 0x10000)           .toString(16)           .substring(1);   }    return s4() + s4() + s4(); }  var clientUUID = generate_request_guid();  XhrInterceptor.addRequestCallback(function(xhr) {   try {       xhr.setRequestHeader('UUID', clientUUID + '#' + generate_request_guid());       xhr.setRequestHeader('C-STARTED', Date.now());   } catch (e) {       console.log(&quot;Can't set request headers. Details:&quot;, e.error.toString());   } });<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f:<\/p>\n<p>  <b>polls\/static\/request_client.js<\/b>  <\/p>\n<pre><code class=\"python\">var logStore = []; var urlForExclude = '';  XhrInterceptor.addResponseCallback(function(xhr) {   try {       var req_uuid = xhr.getResponseHeader('UUID');       var req_started = xhr.getResponseHeader('C-STARTED');        if (req_uuid &amp;&amp; req_started &amp;&amp; !xhr.responseURL.includes(urlForExclude)) {           req_started = parseInt(req_started, 10);            var s_total = parseFloat(xhr.getResponseHeader('REQUEST-TOTAL') || 0);            var record = {               'uuid': req_uuid,               'c_total': Math.max(Date.now() - req_started, s_total, 0),               'started': xhr.getResponseHeader('STARTED') || '',               'path': xhr.getResponseHeader('PATH') || '',               'total': s_total,               'sql_count': parseInt(xhr.getResponseHeader('SQL-COUNT') || 0),               'sql_total': parseFloat(xhr.getResponseHeader('SQL-TOTAL') || 0),           };            record['tr_total'] = (record['c_total'] - record['total']).toFixed(4);           logStore.push(record);       }    } catch (e) {       console.log(&quot;Can't process response. Details:&quot;, e.error.toString());   } }); <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442:<\/p>\n<p>  <b>polls\/static\/request_client.js<\/b>  <\/p>\n<pre><code class=\"python\">\/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c XhrInterceptor.wire();  function startLogging(clientLogUrl, timeout = 10000) {   function sendRequestStats() {       if (logStore.length) {           var log_part = JSON.stringify(logStore.slice());           logStore = [];            var xhttp = new XMLHttpRequest();           xhttp.open(&quot;POST&quot;, clientLogUrl, true);           xhttp.setRequestHeader('Content-Type', 'application\/x-www-form-urlencoded');           xhttp.send(&quot;logs=&quot; + log_part);       }   }    urlForExclude = clientLogUrl;   setInterval(sendRequestStats, timeout); } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u2014 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0445 \u0432 middleware:<\/p>\n<p>  <b>polls\/middleware.py<\/b>  <\/p>\n<pre><code class=\"python\">....  def __call__(self, request):    thread_locals.path = request.path    thread_locals.sql_count = 0    thread_locals.sql_total = 0    timestamp = time.monotonic()     response = self.get_response(request)     data = {        'uuid': request.META.get('HTTP_UUID'),        'c_started': request.META.get('HTTP_C_STARTED'),        'path': request.path,        'request_total': round(time.monotonic() - timestamp, 3),        'sql_count': thread_locals.sql_count,        'sql_total': round(thread_locals.sql_total, 3),    }     for key, value in data.items():        response[key.capitalize().replace(&quot;_&quot;, &quot;-&quot;)] = value     thread_locals.sql_total = 0    thread_locals.sql_count = 0    thread_locals.path = ''     return response<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f view:<\/p>\n<p>  <b>polls\/views.py<\/b>  <\/p>\n<pre><code class=\"python\">import json  from django.http import HttpResponse from django.template import loader from django.views.decorators.csrf import csrf_exempt   @csrf_exempt def save_client_log(request):   &quot;&quot;&quot;   \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u043b\u043e\u0433   &quot;&quot;&quot;   logs = request.POST.get('logs', '[]')   with open('request.log', 'a') as f:      for log_str in json.loads(logs):          f.write(json.dumps(log_str) + '\\n')    return HttpResponse()<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0432\u0435 view: \u043e\u0434\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u0434\u043b\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f:<\/p>\n<p>  <b>polls\/views.py<\/b>  <\/p>\n<pre><code class=\"python\">import datetime  ....  def get_page_with_button(request):    &quot;&quot;&quot;    \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u043a\u043d\u043e\u043f\u043a\u043e\u0439    &quot;&quot;&quot;    template = loader.get_template('polls\/index.html')     return HttpResponse(template.render({}, request))   def get_current_datetime(request):    &quot;&quot;&quot;    \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0434\u0430\u0442\u0443 \u0438 \u0432\u0440\u0435\u043c\u044f    &quot;&quot;&quot;    return HttpResponse(datetime.datetime.now())<\/code><\/pre>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <b>polls\/templates\/polls\/index.html<\/b>  <\/p>\n<pre><code class=\"xml\">&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt;     &lt;meta charset=&quot;UTF-8&quot;&gt;     {% load static %}     &lt;script src=&quot;{% static 'xhr_interceptor.js' %}&quot;&gt;&lt;\/script&gt;     &lt;script src=&quot;{% static 'request_client.js' %}&quot;&gt;&lt;\/script&gt;     &lt;script&gt;         function getDateTime() {             var xhttp = new XMLHttpRequest();             xhttp.onreadystatechange = function() {                 if (this.readyState == 4 &amp;&amp; this.status == 200) {                     document.getElementById(&quot;datetime&quot;).innerHTML = this.responseText;                 }             };             xhttp.open(&quot;GET&quot;, &quot;{% url 'current_datetime' %}&quot;, true);             xhttp.send();         }     &lt;\/script&gt;     &lt;script&gt;         startLogging(&quot;{% url 'save_client_log' %}&quot;);     &lt;\/script&gt;      &lt;title&gt;Title&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt;  &lt;button type=&quot;button&quot; onclick=&quot;getDateTime()&quot;&gt;\u0417\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0434\u0430\u0442\u0443 \u0438 \u0432\u0440\u0435\u043c\u044f&lt;\/button&gt;  &lt;div id=&quot;datetime&quot;&gt;  &lt;\/div&gt;  &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 view \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 urls.py:<\/p>\n<p>  <b>polls\/urls.py<\/b>  <\/p>\n<pre><code class=\"python\">from django.urls import path  from . import views   urlpatterns = [    path('', views.get_page_with_button, name='page_with_button'),    path('current-datetime', views.get_current_datetime, name='current_datetime'),    path('save-client-log', views.save_client_log, name='save_client_log'), ] <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043d\u0430 <a href=\"http:\/\/127.0.0.1:8000\/polls\/\">http:\/\/127.0.0.1:8000\/polls\/<\/a>, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 request.log \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438. \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e \u043c\u0435\u0442\u043a\u0435 <b>stage_06<\/b>.<\/p>\n<h3>\u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f)<\/h3>\n<p>  \u0421\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u044b\u0440\u043e\u043c \u0432\u0438\u0434\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e. \u0422\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u0447\u0442\u043e, \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u0437\u044f\u0442\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u0432\u0430\u0436\u043d\u0435\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0442\u0435\u043a\u043e\u043c ELK. \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/www.elastic.co\/guide\/en\/elastic-stack\/current\/installing-elastic-stack.html\">\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443<\/a> \u0438\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432 \u0441\u0435\u0442\u0438. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c logstash \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 elasticsearch, \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0432 \u043a\u043e\u043d\u0444\u0438\u0433 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443:<\/p>\n<pre><code class=\"django\">input {   file {     path =&gt; &quot;\/\u043f\u0443\u0442\u044c\/\u0434\u043e\/\u043b\u043e\u0433\u043e\u0432\/**\/*.log&quot;     start_position =&gt; &quot;beginning&quot;   } } filter {   json {       source =&gt; &quot;message&quot;   }   date {       match =&gt; [ &quot;[started]&quot;, &quot;yyyy-MM-dd HH:mm:ss'.'SSSSSS&quot;]   } } output {   elasticsearch {     hosts =&gt; &quot;http:\/\/\u0430\u0434\u0440\u0435\u0441-elasticsearch&quot;     manage_template =&gt; false     index =&gt; &quot;requests-%{+YYYY.MM.dd}&quot;     document_type =&gt; &quot;%{[@metadata][type]}&quot;   } } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f filebeat, \u0442\u043e input \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<pre><code class=\"django\">input {   beats {     port =&gt; &quot;5044&quot;     ssl  =&gt; false   } }<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0438\u043c\u0438 \u2014 \u0432\u0435\u043b\u0438\u043a\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438\u0445 \u0432 dashboard\u2019\u044b; \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043f\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c \u0438 \u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c. \u0412\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0440\u0435\u0448\u0438\u0442\u044c. \u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/l2\/nb\/bg\/l2nbbgfaegvqfbl6prmhybw5rb0.png\"><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/n4\/fd\/en\/n4fdenrdbhmhyuyjxywfuzskbck.png\"><\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0417\u0430 \u043a\u0430\u0434\u0440\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a \u043f\u043e \u043d\u0438\u043c. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0432 \u043f\u0430\u043a\u0435\u0442\u0435 <a href=\"https:\/\/pypi.org\/project\/production-request\/\">production-request<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 production-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u041f\u043e \u043c\u0435\u0440\u0435 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432 \u043f\u0430\u043a\u0435\u0442 \u0434\u043e\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442\u0441\u044f. \u0412 \u043f\u043b\u0430\u043d\u0430\u0445 \u2014 \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043f\u0430\u043a\u0435\u0442\u0430 \u043d\u0430 github.<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/barsgroup\/blog\/523068\/\"> https:\/\/habr.com\/ru\/company\/barsgroup\/blog\/523068\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/barsgroup\/blog\/523068\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/da\/m5\/sv\/dam5svl0yybrq3pzb8tjwkjrnkw.jpeg\"><\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0414\u043c\u0438\u0442\u0440\u0438\u0439 \u0427\u0435\u0440\u043d\u044b\u0448\u043e\u0432, \u044f \u0432\u0435\u0434\u0443\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u00ab\u0411\u0410\u0420\u0421 \u0413\u0440\u0443\u043f\u00bb. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u0441\u0440\u0435\u0434\u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430\u043c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 Django \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0449\u0438\u043c\u0438\u0441\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f\u043c\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0443 \u043d\u0430\u0441 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b. <\/p>\n<h3>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f\/\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h3>\n<p>  \u0412 Django \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b:<\/p>\n<ul>\n<li>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0434\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439?<\/li>\n<li>\u041a\u0430\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e?<\/li>\n<li>\u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0421\u0423\u0411\u0414?<\/li>\n<li>\u0412 \u043a\u0430\u043a\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0441\u0430\u043c\u044b\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438?<\/li>\n<\/ul>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-311434","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311434"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311434\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}