{"id":284081,"date":"2017-03-29T11:55:02","date_gmt":"2017-03-29T07:55:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=284081"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=284081","title":{"rendered":"\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0431\u043b\u043e\u0433 \u043d\u0430 Wagtail CMS (Django) \u2014 \u0447\u0430\u0441\u0442\u044c 3, \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f"},"content":{"rendered":"<p>\u0422\u0440\u0435\u0442\u044c\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e Wagtail CMS \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u0432\u0435\u0442\u0438\u0442\u044c \u0442\u0435\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u0438 \u043c\u043d\u0435 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u044e\u0431\u0438\u0442\u044c Django. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442 \u044d\u0442\u0443 CMS, \u043b\u044e\u0431\u043e\u0439 \u043d\u0430\u0439\u0434\u0435\u0442 \u0432 \u043d\u0435\u0439 \u0447\u0442\u043e-\u0442\u043e \u0434\u043b\u044f \u0441\u0435\u0431\u044f.<br \/>  \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>StreamField<\/li>\n<li>API + React<\/li>\n<li>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043b\u044f e-commerce<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2a5\/d59\/240\/2a5d592409df4b8e93bb180e254629b1.png\" alt=\"image\"\/><\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u0412 \u0444\u0435\u0432\u0440\u0430\u043b\u0435 2017 \u0433\u043e\u0434\u0430 \u0432\u044b\u0448\u043b\u0430 \u0432\u0435\u0440\u0441\u0438\u044f 1.9.0, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e, \u0438 \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 Many-to-Many. <\/p>\n<p>  \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0435 \u043c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u0432 \u043d\u0435\u043c \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u043d\u044b \u043c\u043d\u043e\u0433\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 Hallo.js \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435.<br \/>  \u041a\u0430\u043a\u0438\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438, \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b?<br \/>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0438\u043b\u044c \u0441\u0442\u0440\u043e\u043a\u0435, \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c html \u0442\u0435\u0433, \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0441\u043e style \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0446\u0438\u0442\u0430\u0442\u0443, \u043a\u043e\u0434 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435. \u0412\u0441\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u043c Hallo.JS \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u0441\u043e\u0432\u0441\u0435\u043c. <\/p>\n<h3>StreamField<\/h3>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0432 WagtailCMS \u043c\u043e\u0434\u0435\u043b\u044c\u044e StreamField. <\/p>\n<p>  <b>StreamField<\/b> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0431\u043b\u043e\u0433\u0430 \u0438\u043b\u0438 \u043d\u043e\u0432\u043e\u0441\u0442\u0438 \u2014 \u0433\u0434\u0435 \u0442\u0435\u043a\u0441\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u043f\u0435\u0440\u0435\u043c\u0435\u0448\u043a\u0443 \u0441 \u043f\u043e\u0434\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0446\u0438\u0442\u0430\u0442\u0430\u043c\u0438, \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439 \u0432\u0438\u0434\u0435\u043e \u0438 \u043f\u0440\u043e\u0447\u0435\u0435. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u043a\u0430\u0440\u0442\u044b \u0438 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b (\u0438\u043b\u0438, \u0432\u0441\u0442\u0430\u0432\u043a\u0438 HTML \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443). \u0412 \u044d\u0442\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u00ab\u0431\u043b\u043e\u043a\u043e\u0432\u00bb, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"python\">from django.db import models  from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.fields import StreamField from wagtail.wagtailcore import blocks from wagtail.wagtailadmin.edit_handlers import FieldPanel, StreamFieldPanel #\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c StreamFieldPanel from wagtail.wagtailimages.blocks import ImageChooserBlock #\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 StreamField \u043d\u0443\u0436\u043d\u044b\u0435 \u0431\u043b\u043e\u043a\u0438  class BlogPage(Page):     author = models.CharField(max_length=255)     date = models.DateField(&quot;Post date&quot;)     body = StreamField([         ('heading', blocks.CharBlock(classname=&quot;full title&quot;)),         ('paragraph', blocks.RichTextBlock()),         ('image', ImageChooserBlock()),     ])      content_panels = Page.content_panels + [         FieldPanel('author'),         FieldPanel('date'),         StreamFieldPanel('body'),     ] <\/code><\/pre>\n<p>  \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 StreamField \u0441 \u0442\u0440\u0435\u043c\u044f \u0431\u043b\u043e\u043a\u0430\u043c\u0438 \u2014 heading, paragraph, image.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443  <\/p>\n<pre><code class=\"python\">body = RichTextField(blank=True)<\/code><\/pre>\n<p>  \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u043d\u0430\u043c\u0438 StreamField.<\/p>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e \u2014 python manage.py makemigrations \u0438 python manage.py migrate<\/p>\n<p>  <b>! \u041e\u0434\u043d\u043e \u0432\u0430\u0436\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/b>, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0440\u0430\u043d\u0435\u0435 \u0431\u044b\u043b RichTextField, \u0442\u043e \u0432\u0430\u043c \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u2014 <a href=\"http:\/\/docs.wagtail.io\/en\/v1.9\/topics\/streamfield.html#streamfield-migrating-richtext\">http:\/\/docs.wagtail.io\/en\/v1.9\/topics\/streamfield.html#streamfield-migrating-richtext<\/a><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u0430\u0434\u043c\u0438\u043d.\u043f\u0430\u043d\u0435\u043b\u044c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0431\u043b\u043e\u043a\u0438 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/738\/14b\/d22\/73814bd222b0438e882fb22f2419f0f7.png\" alt=\"image\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u043b\u043e\u043a\u0438 streamfield.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 HTML \u0432 \u0432\u0430\u0448\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0442\u0435\u0433: <\/p>\n<pre><code class=\"python\">{% include_block page.body %}<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"python\">&lt;article&gt;     {% for block in page.body %}         {% if block.block_type == 'heading' %}             &lt;h1&gt;{{ block.value }}&lt;\/h1&gt;         {% else %}             &lt;section class=&quot;block-{{ block.block_type }}&quot;&gt;                 {% include_block block %}             &lt;\/section&gt;         {% endif %}     {% endfor %} &lt;\/article&gt;<\/code><\/pre>\n<p>  \u042f \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0431\u043b\u043e\u043a\u0430\u043c\u0438, \u043d\u043e \u0432\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u0432\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445:  <\/p>\n<ul>\n<li>CharBlock<\/li>\n<li>TextBlock<\/li>\n<li>EmailBlock<\/li>\n<li>URLBlock<\/li>\n<li>DateBlock<\/li>\n<li>RawHTMLBlock<\/li>\n<\/ul>\n<p>  \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"http:\/\/docs.wagtail.io\/en\/v1.9\/topics\/streamfield.html\">\u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a> \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c StreamField \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<h3>API + React<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f API \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441 React \u0438\u043b\u0438 Vue, \u0442\u043e \u0438 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0432\u0441\u0435 \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0432 Wagtail API.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 wagtail.api.v2 \u0432 INSTALLED_APPS:<\/p>\n<pre><code class=\"python\"># settings.py  INSTALLED_APPS = [     ...      'wagtail.api.v2',      ... ]<\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u0442\u0435 endpoints:  <\/p>\n<pre><code class=\"python\"># api.py  from wagtail.api.v2.endpoints import PagesAPIEndpoint from wagtail.api.v2.router import WagtailAPIRouter from wagtail.wagtailimages.api.v2.endpoints import ImagesAPIEndpoint from wagtail.wagtaildocs.api.v2.endpoints import DocumentsAPIEndpoint  # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0442\u043e\u0440\u0430. &quot;wagtailapi&quot; \u044d\u0442\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 URL. api_router = WagtailAPIRouter('wagtailapi')  # \u042d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u043c endpoints, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b api_router.register_endpoint('pages', PagesAPIEndpoint) api_router.register_endpoint('images', ImagesAPIEndpoint) api_router.register_endpoint('documents', DocumentsAPIEndpoint) <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0434\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c URL \u0434\u043b\u044f API:<\/p>\n<pre><code class=\"python\"># urls.py  from .api import api_router  urlpatterns = [     ...     url(r'^api\/v2\/', api_router.urls),     ...     # \u0412\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a API \u0431\u044b\u043b\u043e \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c wagtail_urls     url(r'', include(wagtail_urls)), ] <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0430\u043c \/api\/v2\/pages\/, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \/api\/v2\/images\/, \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \/api\/v2\/documents\/<\/p>\n<p>  \u041f\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044e, \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c rest_framework \u043a INSTALLED_APPS. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u0442 API \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u043f\u0440\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n<p>  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e <a href=\"http:\/\/docs.wagtail.io\/en\/v1.9\/advanced_topics\/api\/index.html\">Wagtail API<\/a>.<\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Wagtail \u0421MS + React \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u2014 <a href=\"https:\/\/github.com\/emilyhorsman\/wagtail-react-blog\">https:\/\/github.com\/emilyhorsman\/wagtail-react-blog<\/a>. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e <a href=\"https:\/\/habrahabr.ru\/users\/zpa1972\/\" class=\"user_link\">zpa1972<\/a><\/p>\n<p>  <b>\u041f\u043b\u0430\u0433\u0438\u043d \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432<\/b><br \/>  \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0434\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0431\u044b\u043b\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438. \u0411\u043b\u0430\u0433\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0434\u043b\u044f Django \u043f\u043e\u043b\u043d\u043e, \u0438 \u043e\u043d\u0438 \u043b\u0435\u0433\u043a\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 Wagtail CMS. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043d\u0430 \u0431\u0430\u0437\u0435 Wagtail, \u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c <a href=\"https:\/\/github.com\/takeflight\/wagtailcomments\">https:\/\/github.com\/takeflight\/wagtailcomments<\/a><\/p>\n<h3>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043b\u044f e-commerce<\/h3>\n<p>  \u0418 \u0432\u043e\u0442 \u043c\u044b \u0443\u0436\u0435 \u0434\u043e\u0448\u043b\u0438 \u0434\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 Django \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u044c \u0438 \u0441\u0442\u0440\u0430\u0434\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 e-commerce \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u041d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043c\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d \u0441 \u0430\u0441\u0441\u043e\u0440\u0442\u0438\u043c\u0435\u043d\u0442\u043e\u043c \u043e\u043a\u043e\u043b\u043e 10 000 \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u043a\u043e\u0440\u0437\u0438\u043d\u043e\u0439, \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u043e\u0439, \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c\u0438 \u0437\u0430\u043a\u0430\u0437\u043e\u0432 \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0430\u0434\u043c\u0438\u043d.\u043f\u0430\u043d\u0435\u043b\u044c\u044e.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u044f \u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e, \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u0430\u043b \u0444\u043e\u0440\u0443\u043c\u044b \u043f\u043e \u0442\u0435\u043c\u0435, \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438 \u0440\u0435\u0448\u0438\u0432, \u0447\u0442\u043e Wagtail CMS \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043f\u0438\u043b\u0438\u0432\u0430\u0442\u044c \u0434\u043e\u043b\u0433\u043e, \u0432\u044b\u0431\u0440\u0430\u043b Django-oscar.<\/p>\n<p>  \u0422\u0443\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043a\u043e\u043d\u0435\u0446 \u043c\u043e\u0435\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430, \u043d\u043e \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u0438\u0437\u0443\u0447\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0443 \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043f\u0440\u043e Wagtail \u044f \u043d\u0430\u0448\u0435\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u0436\u0435 \u0433\u043e\u0440\u0435\u043b \u0438\u0434\u0435\u0435\u0439 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f e-commerce \u043d\u0430 \u0431\u0430\u0437\u0435 Wagtail CMS.<\/p>\n<p>  \u0422\u0430\u043a \u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/JamesRamm\/longclaw\">https:\/\/github.com\/JamesRamm\/longclaw<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442 James Ramm.<\/p>\n<p>  \u041e\u043d \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043d\u043e \u043c\u043d\u043e\u0433\u043e\u0435 \u0432 \u043d\u0435\u043c \u0443\u0436\u0435 \u0435\u0441\u0442\u044c. \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 Longclaw \u0441\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u044f\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u0436\u0435 Django-oscar.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u0432 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8b6\/35a\/cf7\/8b635acf7266407294b9389f6315ff38.png\" alt=\"image\"\/><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:\/\/habrahabr.ru\/post\/325110\/\"> https:\/\/habrahabr.ru\/post\/325110\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0422\u0440\u0435\u0442\u044c\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e Wagtail CMS \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u0432\u0435\u0442\u0438\u0442\u044c \u0442\u0435\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u0438 \u043c\u043d\u0435 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u044e\u0431\u0438\u0442\u044c Django. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442 \u044d\u0442\u0443 CMS, \u043b\u044e\u0431\u043e\u0439 \u043d\u0430\u0439\u0434\u0435\u0442 \u0432 \u043d\u0435\u0439 \u0447\u0442\u043e-\u0442\u043e \u0434\u043b\u044f \u0441\u0435\u0431\u044f.<br \/>  \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b:<\/p>\n<ul>\n<li>StreamField<\/li>\n<li>API + React<\/li>\n<li>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u043b\u044f e-commerce<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2a5\/d59\/240\/2a5d592409df4b8e93bb180e254629b1.png\" alt=\"image\"\/><\/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-284081","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284081","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=284081"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284081\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=284081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=284081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}