{"id":374589,"date":"2024-05-21T06:03:57","date_gmt":"2024-05-21T06:03:57","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=374589"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=374589","title":{"rendered":"<span>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Markdown \u0432 Django<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, <strong>Habr<\/strong>!<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f <strong>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Markdown \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Django \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u043b\u043e\u0433\u0430<\/strong>. \u041e\u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f. \u0415\u0451 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <strong>.md<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0432 \u043c\u043e\u0451\u043c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0449\u0435\u043c\u0441\u044f <a href=\"https:\/\/t.me\/coding_lifestyle\" rel=\"noopener noreferrer nofollow\">Telegram \u043a\u0430\u043d\u0430\u043b\u0435<\/a>.<\/p>\n<p><strong>Markdown<\/strong> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u044f\u0437\u044b\u043a \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 <strong>\u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, HTML) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430<\/strong>. \u041a\u0441\u0442\u0430\u0442\u0438, \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u043f\u0438\u0441\u0430\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 <strong>Markdown<\/strong>)<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h4>\n<pre><code>python -m venv venv  source venv\/bin\/activate<\/code><\/pre>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432<\/h4>\n<pre><code>pip install Django==4.2<\/code><\/pre>\n<p>\u0412\u0435\u0440\u0441\u0438\u044f <strong>Django<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f LTS (\u0432\u0435\u0440\u0441\u0438\u044f \u0441 \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439) \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 <strong>2024<\/strong> \u0433\u043e\u0434\u0430.<\/p>\n<pre><code>pip install markdown<\/code><\/pre>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0430\u0439\u0442\u0430 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n<pre><code>django-admin startproject markdown_blog  cd markdown_blog  python manage.py startapp posts<\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u043e\u0435\u043a\u0442 <em>markdown_blog<\/em><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <em>posts<\/em><\/p>\n<\/li>\n<\/ul>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0441\u0442\u0430<\/h4>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>posts\/models.py<\/em>, \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django.db import models from django.contrib.auth.models import User from django.urls import reverse   class Post(models.Model):     title = models.CharField(max_length=250)     slug = models.SlugField(max_length=250)     author = models.ForeignKey(User,     on_delete=models.CASCADE,     related_name='blog_posts')     body = models.TextField()  def __str__(self): return self.title  def get_absolute_url(self):         return reverse('post_detail',         args=[self.id]) <\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c <em>Post<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044f:<\/p>\n<ul>\n<li>\n<p><code>title<\/code> &#8212; \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u0434\u043b\u0438\u043d\u043e\u0439 \u0434\u043e 250 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><code>slug<\/code> &#8212; \u0421\u043b\u0430\u0433, \u0434\u043b\u0438\u043d\u043e\u0439 \u0434\u043e 250 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><code>author<\/code> &#8212; ForeignKey \u043a \u043c\u043e\u0434\u0435\u043b\u0438 <em>User<\/em>. \u041f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p><code>body<\/code> &#8212; \u0422\u0435\u043a\u0441\u0442 \u043f\u043e\u0441\u0442\u0430 (\u0441 \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u0435\u043c \u043c\u044b \u0438 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c)<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 <em>markdown_blog\/settings.py<\/em>:<\/p>\n<pre><code class=\"python\">INSTALLED_APPS = [   # other apps,   'posts.apps.PostsConfig', ]<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>python manage.py makemigrations  python manage.py migrate<\/code><\/pre>\n<h4>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0430\u0434\u043c\u0438\u043d \u043f\u0430\u043d\u0435\u043b\u0438<\/h4>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>posts\/admin.py<\/em> , \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django.contrib import admin from .models import Post  admin.site.register(Post) <\/code><\/pre>\n<p>\u041c\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c <em>Post<\/em> \u0432 \u0430\u0434\u043c\u0438\u043d \u043f\u0430\u043d\u0435\u043b\u0438.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432<\/h4>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>posts\/views.py<\/em>, \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django.shortcuts import render, get_object_or_404  from .models import Post   def post_list(request):     posts = Post.objects.all()     return render(request,     'post_list.html',     {'posts': posts})  def post_detail(request, id): post = get_object_or_404(Post, id=id) return render(request, 'post_detail.html', {'post': post})  <\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0434\u0432\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><code>post_list<\/code> &#8212; \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u0442\u043e\u0432, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0435\u0433\u043e \u0432 \u0448\u0430\u0431\u043b\u043e\u043d <em>post_list.html<\/em>.<\/p>\n<\/li>\n<li>\n<p><code>post_detail<\/code> &#8212; \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u0442 \u043f\u043e <em>id<\/em>, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u0448\u0430\u0431\u043b\u043e\u043d <em>post_detail.html<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e <em>posts\/templates<\/em> \u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b <em>post_list.html<\/em>. \u0412 \u043d\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"django\">&lt;!DOCTYPE html> &lt;html lang=\"en\">  &lt;head>     &lt;meta charset=\"UTF-8\">     &lt;title>List of posts&lt;\/title> &lt;\/head>  &lt;body> {% for post in posts %} &lt;h2> &lt;a href=\"{{ post.get_absolute_url }}\">{{ post.title }}&lt;\/a> &lt;\/h2> &lt;div> {{ post.body|truncatewords_html:30 }} &lt;\/div> {% endfor %} &lt;\/body> &lt;\/html> <\/code><\/pre>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 <em>posts\/templates<\/em> \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>post_detail.html<\/em>. \u0412 \u043d\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"django\">&lt;!DOCTYPE html> &lt;html lang=\"en\">  &lt;head>     &lt;meta charset=\"UTF-8\">     &lt;title>Post: {{ post.title }}&lt;\/title> &lt;\/head>  &lt;body> &lt;a href='{% url \"post_list\" %}'>List of posts&lt;\/a> &lt;h2> {{ post.title }} &lt;\/h2> &lt;div> {{ post.body }} &lt;\/div> &lt;\/body> &lt;\/html> <\/code><\/pre>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>markdown_blog\/urls.py<\/em>, \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django.contrib import admin from django.urls import path  from posts import views  urlpatterns = [   path('admin\/', admin.site.urls),   path('', views.post_list, name='post_list'),   path('&lt;int:id>\/', views.post_detail, name='post_detail'), ] <\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0434\u0432\u0430 <strong>URL<\/strong> \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 Markdown \u043d\u0430 \u0441\u0430\u0439\u0442<\/h4>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 <strong>Markdown<\/strong> \u043d\u0430 \u0441\u0430\u0439\u0442 &#8212; \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <em>\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e-\u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e<\/em> \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043a\u0435\u0442 <em>posts\/templatetags<\/em>, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b\u044b <em>post_tags.py<\/em>, \u0438 __init.py__. \u0424\u0430\u0439\u043b <em>post_tags.py<\/em> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <em>\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e-\u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u044b\u0445<\/em> \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438 \u0442\u0435\u0433\u043e\u0432. \u0412 \u043d\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django import template from django.utils.safestring import mark_safe  import markdown  register = template.Library()   @register.filter(name='markdown') def markdown_format(text):     return mark_safe(markdown.markdown(text)) <\/code><\/pre>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c <strong>Django<\/strong> \u0444\u0443\u043d\u043a\u0446\u0438\u044e<br \/> <em>mark_safe<\/em>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u0430\u043a \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 <strong>HTML<\/strong>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <strong>Django<\/strong> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u043c\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 <strong>HTML<\/strong> \u0438 \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434 \u0435\u0433\u043e \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439<br \/> \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435<br \/> \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043a\u0430\u043a \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0430\u043a\u043e\u0435<br \/> \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u0430\u0435\u0442 <strong>Django<\/strong> \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<br \/> <strong>HTML<\/strong> \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0434\u0430\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 <strong>HTML<\/strong>.<\/p>\n<p>\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>templates\/post_detail.html<\/em>:<\/p>\n<pre><code class=\"django\">{% load post_tags %} &lt;!DOCTYPE html> &lt;html lang=\"en\">  &lt;head>     &lt;meta charset=\"UTF-8\">     &lt;title>Post: {{ post.title }}&lt;\/title> &lt;\/head>  &lt;body> &lt;a href='{% url \"post_list\" %}'>List of posts&lt;\/a> &lt;h2> {{ post.title }} &lt;\/h2> &lt;div> {{ post.body|markdown }} &lt;\/div> &lt;\/body> &lt;\/html> <\/code><\/pre>\n<p>\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>templates\/post_list.html<\/em>:<\/p>\n<pre><code class=\"django\">{% load post_tags %} &lt;!DOCTYPE html> &lt;html lang=\"en\">  &lt;head>     &lt;meta charset=\"UTF-8\">     &lt;title>List of posts&lt;\/title> &lt;\/head>  &lt;body> {% for post in posts %} &lt;h2> &lt;a href=\"{{ post.get_absolute_url }}\">{{ post.title }}&lt;\/a> &lt;\/h2> &lt;div> {{ post.body|markdown|truncatewords_html:30 }} &lt;\/div> {% endfor %} &lt;\/body> &lt;\/html> <\/code><\/pre>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"bash\">python manage.py createsuperuser<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432\u0441\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438:<\/p>\n<pre><code class=\"bash\">python manage.py runserver<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <em>127.0.0.1:8000\/admin<\/em>, \u0432\u043e\u0439\u0434\u0438\u0442\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u043d\u0435\u0435 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0427\u0435\u0440\u0435\u0437 \u0430\u0434\u043c\u0438\u043d \u043f\u0430\u043d\u0435\u043b\u044c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0442\u043e\u0432 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 <strong>Markdown<\/strong>). \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u0435\u0441\u0442\u044c \u043d\u0438\u0436\u0435:<\/p>\n<ol>\n<li>\n<\/li>\n<\/ol>\n<pre><code class=\"markdown\">**\u041c\u043e\u0434\u0435\u043b\u044c** \u2014 \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438 \u0442\u043e\u0447\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0432\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.  ### \u041e\u0441\u043d\u043e\u0432\u044b - - -  - \u041a\u0430\u0436\u0434\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u043e\u043c `django.db.models.Model`. - \u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. - \u041f\u0440\u0438 \u0432\u0441\u0435\u043c \u044d\u0442\u043e\u043c Django \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0439 API \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445; \u0441\u043c. [\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432](https:\/\/docs.djangoproject.com\/en\/5.0\/topics\/db\/queries\/).   - - - <\/code><\/pre>\n<ol start=\"2\">\n<li>\n<\/li>\n<\/ol>\n<pre><code class=\"markdown\">## MTV  Django \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u0434\u0438\u0437\u0430\u0439\u043d\u0430 **MTV** (Model-Template-View)  \u041e\u0431\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u0434\u0438\u0437\u0430\u0439\u043d\u0430 MTV Django \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435- \u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  - **Model** (\u043c\u043e\u0434\u0435\u043b\u044c) \u2013 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c  - **Template** (\u0448\u0430\u0431\u043b\u043e\u043d) \u2013 \u044d\u0442\u043e \u0441\u043b\u043e\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0412 Django \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432\u0441\u0435, \u0447\u0442\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u0440\u043e\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445.  - **View** (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435) \u2013 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0438\u0445 \u043f\u0440\u043e\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430.   - - - <\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <em>127.0.0.1:8000<\/em>. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u0442\u043e\u0432. \u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u043d\u0430 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0441\u0441\u044b\u043b\u043e\u043a, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u0441\u0451 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<h4>\u0418\u0442\u043e\u0433<\/h4>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 <strong>Markdown<\/strong> \u0432 <strong>Django<\/strong>. \u0426\u0435\u043b\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <em>\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e<\/em> \u0431\u043b\u043e\u0433\u0430, \u0430 \u043b\u0438\u0448\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <strong>Markdown<\/strong>. \u041d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f), \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c.<\/p>\n<p><strong>P.S.<\/strong> \u044d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f. \u0412\u0441\u0435\u043c \u043f\u043e\u043a\u0430, <em>Control + D<\/em>!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/810119\/\"> https:\/\/habr.com\/ru\/articles\/810119\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, <strong>Habr<\/strong>!<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f <strong>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Markdown \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Django \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u043b\u043e\u0433\u0430<\/strong>. \u041e\u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f. \u0415\u0451 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <strong>.md<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0432 \u043c\u043e\u0451\u043c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0449\u0435\u043c\u0441\u044f <a href=\"https:\/\/t.me\/coding_lifestyle\" rel=\"noopener noreferrer nofollow\">Telegram \u043a\u0430\u043d\u0430\u043b\u0435<\/a>.<\/p>\n<p><strong>Markdown<\/strong> \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u044f\u0437\u044b\u043a \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 <strong>\u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, HTML) \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430<\/strong>. \u041a\u0441\u0442\u0430\u0442\u0438, \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u044f \u043f\u0438\u0441\u0430\u043b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 <strong>Markdown<\/strong>)<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h4>\n<pre><code>python -m venv venv  source venv\/bin\/activate<\/code><\/pre>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432<\/h4>\n<pre><code>pip install Django==4.2<\/code><\/pre>\n<p>\u0412\u0435\u0440\u0441\u0438\u044f <strong>Django<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f LTS (\u0432\u0435\u0440\u0441\u0438\u044f \u0441 \u0434\u043e\u043b\u0433\u043e\u0441\u0440\u043e\u0447\u043d\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439) \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 <strong>2024<\/strong> \u0433\u043e\u0434\u0430.<\/p>\n<pre><code>pip install markdown<\/code><\/pre>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0430\u0439\u0442\u0430 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n<pre><code>django-admin startproject markdown_blog  cd markdown_blog  python manage.py startapp posts<\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u043f\u0440\u043e\u0435\u043a\u0442 <em>markdown_blog<\/em><\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 <em>posts<\/em><\/p>\n<\/li>\n<\/ul>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0441\u0442\u0430<\/h4>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>posts\/models.py<\/em>, \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django.db import models from django.contrib.auth.models import User from django.urls import reverse   class Post(models.Model):     title = models.CharField(max_length=250)     slug = models.SlugField(max_length=250)     author = models.ForeignKey(User,     on_delete=models.CASCADE,     related_name='blog_posts')     body = models.TextField()  def __str__(self): return self.title  def get_absolute_url(self):         return reverse('post_detail',         args=[self.id]) <\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c <em>Post<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u043e\u043b\u044f:<\/p>\n<ul>\n<li>\n<p><code>title<\/code> &#8212; \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u0434\u043b\u0438\u043d\u043e\u0439 \u0434\u043e 250 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><code>slug<\/code> &#8212; \u0421\u043b\u0430\u0433, \u0434\u043b\u0438\u043d\u043e\u0439 \u0434\u043e 250 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p><code>author<\/code> &#8212; ForeignKey \u043a \u043c\u043e\u0434\u0435\u043b\u0438 <em>User<\/em>. \u041f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0435\u0433\u043e \u043f\u043e\u0441\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p><code>body<\/code> &#8212; \u0422\u0435\u043a\u0441\u0442 \u043f\u043e\u0441\u0442\u0430 (\u0441 \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u0435\u043c \u043c\u044b \u0438 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c)<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 <em>markdown_blog\/settings.py<\/em>:<\/p>\n<pre><code class=\"python\">INSTALLED_APPS = [   # other apps,   'posts.apps.PostsConfig', ]<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>python manage.py makemigrations  python manage.py migrate<\/code><\/pre>\n<h4>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432 \u0430\u0434\u043c\u0438\u043d \u043f\u0430\u043d\u0435\u043b\u0438<\/h4>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>posts\/admin.py<\/em> , \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django.contrib import admin from .models import Post  admin.site.register(Post) <\/code><\/pre>\n<p>\u041c\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c <em>Post<\/em> \u0432 \u0430\u0434\u043c\u0438\u043d \u043f\u0430\u043d\u0435\u043b\u0438.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432<\/h4>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>posts\/views.py<\/em>, \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django.shortcuts import render, get_object_or_404  from .models import Post   def post_list(request):     posts = Post.objects.all()     return render(request,     'post_list.html',     {'posts': posts})  def post_detail(request, id): post = get_object_or_404(Post, id=id) return render(request, 'post_detail.html', {'post': post})  <\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0434\u0432\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p><code>post_list<\/code> &#8212; \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u0442\u043e\u0432, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0435\u0433\u043e \u0432 \u0448\u0430\u0431\u043b\u043e\u043d <em>post_list.html<\/em>.<\/p>\n<\/li>\n<li>\n<p><code>post_detail<\/code> &#8212; \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0441\u0442 \u043f\u043e <em>id<\/em>, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u0448\u0430\u0431\u043b\u043e\u043d <em>post_detail.html<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e <em>posts\/templates<\/em> \u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b <em>post_list.html<\/em>. \u0412 \u043d\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"django\">&lt;!DOCTYPE html> &lt;html lang=\"en\">  &lt;head>     &lt;meta charset=\"UTF-8\">     &lt;title>List of posts&lt;\/title> &lt;\/head>  &lt;body> {% for post in posts %} &lt;h2> &lt;a href=\"{{ post.get_absolute_url }}\">{{ post.title }}&lt;\/a> &lt;\/h2> &lt;div> {{ post.body|truncatewords_html:30 }} &lt;\/div> {% endfor %} &lt;\/body> &lt;\/html> <\/code><\/pre>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 <em>posts\/templates<\/em> \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>post_detail.html<\/em>. \u0412 \u043d\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"django\">&lt;!DOCTYPE html> &lt;html lang=\"en\">  &lt;head>     &lt;meta charset=\"UTF-8\">     &lt;title>Post: {{ post.title }}&lt;\/title> &lt;\/head>  &lt;body> &lt;a href='{% url \"post_list\" %}'>List of posts&lt;\/a> &lt;h2> {{ post.title }} &lt;\/h2> &lt;div> {{ post.body }} &lt;\/div> &lt;\/body> &lt;\/html> <\/code><\/pre>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>markdown_blog\/urls.py<\/em>, \u0438 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django.contrib import admin from django.urls import path  from posts import views  urlpatterns = [   path('admin\/', admin.site.urls),   path('', views.post_list, name='post_list'),   path('&lt;int:id>\/', views.post_detail, name='post_detail'), ] <\/code><\/pre>\n<p>\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0434\u0432\u0430 <strong>URL<\/strong> \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 Markdown \u043d\u0430 \u0441\u0430\u0439\u0442<\/h4>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 <strong>Markdown<\/strong> \u043d\u0430 \u0441\u0430\u0439\u0442 &#8212; \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <em>\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e-\u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0433\u043e<\/em> \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0430.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0430\u043a\u0435\u0442 <em>posts\/templatetags<\/em>, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b\u044b <em>post_tags.py<\/em>, \u0438 __init.py__. \u0424\u0430\u0439\u043b <em>post_tags.py<\/em> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <em>\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e-\u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u044b\u0445<\/em> \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438 \u0442\u0435\u0433\u043e\u0432. \u0412 \u043d\u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"python\">from django import template from django.utils.safestring import mark_safe  import markdown  register = template.Library()   @register.filter(name='markdown') def markdown_format(text):     return mark_safe(markdown.markdown(text)) <\/code><\/pre>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c <strong>Django<\/strong> \u0444\u0443\u043d\u043a\u0446\u0438\u044e<br \/> <em>mark_safe<\/em>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u0430\u043a \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 <strong>HTML<\/strong>. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <strong>Django<\/strong> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u043c\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 <strong>HTML<\/strong> \u0438 \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434 \u0435\u0433\u043e \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439<br \/> \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435<br \/> \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043a\u0430\u043a \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435, \u0447\u0442\u043e\u0431\u044b \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0422\u0430\u043a\u043e\u0435<br \/> \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u0430\u0435\u0442 <strong>Django<\/strong> \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<br \/> <strong>HTML<\/strong> \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u0434\u0430\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 <strong>HTML<\/strong>.<\/p>\n<p>\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>templates\/post_detail.html<\/em>:<\/p>\n<pre><code class=\"django\">{% load post_tags %} &lt;!DOCTYPE html> &lt;html lang=\"en\">  &lt;head>     &lt;meta charset=\"UTF-8\">     &lt;title>Post: {{ post.title }}&lt;\/title> &lt;\/head>  &lt;body> &lt;a href='{% url \"post_list\" %}'>List of posts&lt;\/a> &lt;h2> {{ post.title }} &lt;\/h2> &lt;div> {{ post.body|markdown }} &lt;\/div> &lt;\/body> &lt;\/html> <\/code><\/pre>\n<p>\u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>templates\/post_list.html<\/em>:<\/p>\n<pre><code class=\"django\">{% load post_tags %} &lt;!DOCTYPE html> &lt;html lang=\"en\">  &lt;head>     &lt;meta charset=\"UTF-8\">     &lt;title>List of posts&lt;\/title> &lt;\/head>  &lt;body> {% for post in posts %} &lt;h2> &lt;a href=\"{{ post.get_absolute_url }}\">{{ post.title }}&lt;\/a> &lt;\/h2> &lt;div> {{ post.body|markdown|truncatewords_html:30 }} &lt;\/div> {% endfor %} &lt;\/body> &lt;\/html> <\/code><\/pre>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<pre><code class=\"bash\">python manage.py createsuperuser<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432\u0441\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0435\u0440\u0432\u0435\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438:<\/p>\n<pre><code class=\"bash\">python manage.py runserver<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <em>127.0.0.1:8000\/admin<\/em>, \u0432\u043e\u0439\u0434\u0438\u0442\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u043d\u0435\u0435 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0427\u0435\u0440\u0435\u0437 \u0430\u0434\u043c\u0438\u043d \u043f\u0430\u043d\u0435\u043b\u044c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0442\u043e\u0432 (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 <strong>Markdown<\/strong>). \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u0435\u0441\u0442\u044c \u043d\u0438\u0436\u0435:<\/p>\n<ol>\n<li>\n<\/li>\n<\/ol>\n<pre><code class=\"markdown\">**\u041c\u043e\u0434\u0435\u043b\u044c** \u2014 \u044d\u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0438 \u0442\u043e\u0447\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0432\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445.  ### \u041e\u0441\u043d\u043e\u0432\u044b - - -  - \u041a\u0430\u0436\u0434\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u043e\u043c `django.db.models.Model`. - \u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. - \u041f\u0440\u0438 \u0432\u0441\u0435\u043c \u044d\u0442\u043e\u043c Django \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0439 API \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445; \u0441\u043c. [\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432](https:\/\/docs.djangoproject.com\/en\/5.0\/topics\/db\/queries\/).   - - - <\/code><\/pre>\n<ol start=\"2\">\n<li>\n<\/li>\n<\/ol>\n<pre><code class=\"markdown\">## MTV  Django \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u0434\u0438\u0437\u0430\u0439\u043d\u0430 **MTV** (Model-Template-View)  \u041e\u0431\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u0434\u0438\u0437\u0430\u0439\u043d\u0430 MTV Django \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435- \u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  - **Model** (\u043c\u043e\u0434\u0435\u043b\u044c) \u2013 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c  - **Template** (\u0448\u0430\u0431\u043b\u043e\u043d) \u2013 \u044d\u0442\u043e \u0441\u043b\u043e\u0439 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0412 Django \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432\u0441\u0435, \u0447\u0442\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u0440\u043e\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445.  - **View** (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435) \u2013 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0438\u0445 \u043f\u0440\u043e\u0440\u0438\u0441\u043e\u0432\u043a\u0438 \u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430.   - - - <\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <em>127.0.0.1:8000<\/em>. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0441\u0442\u043e\u0432. \u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u043d\u0430 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0441\u0441\u044b\u043b\u043e\u043a, \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u0441\u0451 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<h4>\u0418\u0442\u043e\u0433<\/h4>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 <strong>Markdown<\/strong> \u0432 <strong>Django<\/strong>. \u0426\u0435\u043b\u044c\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <em>\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e<\/em> \u0431\u043b\u043e\u0433\u0430, \u0430 \u043b\u0438\u0448\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <strong>Markdown<\/strong>. \u041d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f), \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c.<\/p>\n<p><strong>P.S.<\/strong> \u044d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f. \u0412\u0441\u0435\u043c \u043f\u043e\u043a\u0430, <em>Control + D<\/em>!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/810119\/\"> https:\/\/habr.com\/ru\/articles\/810119\/<\/a><br \/><\/br><\/br><\/p>\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-374589","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/374589","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=374589"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/374589\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}