{"id":298416,"date":"2020-02-09T09:00:13","date_gmt":"2020-02-09T09:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=298416"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-02-09T09:00:13","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=298416","title":{"rendered":"RealWorld: aiohttp, Tortoise ORM"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/487610\/\">\n<h1 id=\"realworld-aiohttp-tortoise-orm\">RealWorld: aiohttp, Tortoise ORM<\/h1>\n<p>  <\/p>\n<p>\u041d\u0430 Real World <a href=\"https:\/\/github.com\/gothinkster\/realworld\" rel=\"nofollow\">https:\/\/github.com\/gothinkster\/realworld<\/a> \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f aiohttp, \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u041e\u043f\u044b\u0442\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u043f\u043e\u0445\u043e\u0436\u0435, \u043d\u0435\u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f, \u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0432 aiohttp \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u042f \u043d\u0430\u0447\u0430\u043b \u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Tortoise ORM. \u041f\u043e\u043a\u0430 \u043d\u0430\u0447\u0430\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u043f\u044b\u0442\u043d\u044b\u043c aiohttp \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u043a\u0430\u043c.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"ustanovka-proekta\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>  <\/p>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439: <a href=\"https:\/\/github.com\/nomhoi\/aiohttp-realworld-example-app\" rel=\"nofollow\">https:\/\/github.com\/nomhoi\/aiohttp-realworld-example-app<\/a><\/p>\n<p>  <\/p>\n<p>\u0421\u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0439\u0442\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439:<\/p>\n<p>  <\/p>\n<blockquote><p>git clone git@github.com:nomhoi\/aiohttp-realworld-example-app.git<\/p><\/blockquote>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Python 3.8. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<p>  <\/p>\n<blockquote><p>pip install -r requirements.txt<\/p><\/blockquote>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<blockquote><p>python init_db.py<\/p><\/blockquote>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<p>  <\/p>\n<blockquote><p>python -m conduit<\/p><\/blockquote>\n<p>\u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 Postman \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f <strong>RealWorld.postman_collection.json<\/strong>. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0435 \u0432 Postman \u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f API.<\/p>\n<p>  <\/p>\n<h2 id=\"postgresql\">PostgreSQL<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 SQLite.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f PostrgeSQL \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e DB_URL \u0432 \/conduit\/settings.py.<\/p>\n<p>  <\/p>\n<blockquote><p>DB_URL = &quot;postgres:\/\/postgres:postgres@0.0.0.0:5432\/postgres&quot;<\/p><\/blockquote>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<blockquote><p>docker-compose up -d<\/p><\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<blockquote><p>python init_db.py<\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"faylovaya-struktura-proekta\">\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>  <\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u043c \u0432 Django: \u0432\u0441\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0443\u0440\u043e\u0432\u043d\u0435 \u0447\u0442\u043e \u0438 \u043f\u0430\u043f\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0437 \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<p>  <\/p>\n<p>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f, \u043f\u0440\u043e\u0444\u0438\u043b\u0438 \u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 RealWorld \u0434\u043b\u044f <a href=\"https:\/\/github.com\/gothinkster\/django-realworld-example-app\" rel=\"nofollow\">Django<\/a>. <\/p>\n<p>  <\/p>\n<p>\u041f\u0430\u043f\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u2014 conduit.<\/p>\n<p>  <\/p>\n<h2 id=\"realizovannoe-api\">\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 API<\/h2>\n<p>  <\/p>\n<p>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f API \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/github.com\/gothinkster\/realworld\/tree\/master\/api\" rel=\"nofollow\">https:\/\/github.com\/gothinkster\/realworld\/tree\/master\/api<\/a><\/p>\n<p>  <\/p>\n<p><strong>POST \/api\/users<\/strong> \u2014 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<p>  <\/p>\n<p><strong>POST \/api\/users\/login<\/strong> \u2014 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<p>  <\/p>\n<p><strong>GET \/api\/user<\/strong> \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u044d\u0442\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \/authentication\/views.py.<\/p>\n<p>  <\/p>\n<h2 id=\"cors\">CORS<\/h2>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/aio-libs\/aiohttp-cors\" rel=\"nofollow\">aiohttp_cors<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\"># Configure default CORS settings. cors = aiohttp_cors.setup(app, defaults={     &quot;*&quot;: aiohttp_cors.ResourceOptions(         allow_credentials=True,         expose_headers=&quot;*&quot;,         allow_headers=&quot;*&quot;,     ) })  # Configure CORS on all routes. for route in list(app.router.routes()):     cors.add(route)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0432\u0441\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0440\u0438\u0434\u0436\u0438\u043d\u043e\u0432, \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u043e\u0431\u0449\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0440\u043e\u0443\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<h2 id=\"jwt\">JWT<\/h2>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f aiohttp_jwt:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">    app = web.Application(         middlewares=[             JWTMiddleware(                 settings.SECRET_KEY,                 whitelist=[                     r'\/api\/users',                 ]             )         ]     )<\/code><\/pre>\n<p>  <\/p>\n<p>JWT \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 Authorizstion \u0432\u043c\u0435\u0441\u0442\u043e Token \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u043e Bearer. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043b\u044f Django \u2014 Token. \u0411\u0443\u0434\u0435\u0442 \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0441 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434\u0430\u043c\u0438 \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b.<\/p>\n<p>  <\/p>\n<h2 id=\"model-user\">\u041c\u043e\u0434\u0435\u043b\u044c User<\/h2>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/tortoise\/tortoise-orm\" rel=\"nofollow\">Tortoise ORM<\/a><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">class TimestampedMixin:     created_at = fields.DatetimeField(auto_now_add=True)     updated_at = fields.DatetimeField(auto_now=True)  class AbstractBaseModel(Model):     id = fields.IntField(pk=True)      class Meta:         abstract = True  class User(TimestampedMixin, AbstractBaseModel):     username = fields.CharField(db_index=True, max_length=255, unique=True)     email = fields.CharField(db_index=True, max_length=255, unique=True)     password = fields.CharField(max_length=128)      class Meta:         table = &quot;user&quot;      def __str__(self):         return self.username<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0443 \u043a\u0430\u043a \u0432 Django \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">ordering = ['-created_at', '-updated_at']<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u043a\u0435\u043d\u0430 \u0438\u0437 \u0432\u044c\u044e\u0445\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043c\u043e\u0434\u0435\u043b\u044c User. \u041e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. <\/p>\n<p>  <\/p>\n<p>\u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u0432 Django: \u0445\u044d\u0448 + \u0441\u043e\u043b\u044c \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c PBKDF2. \u041f\u043e\u043a\u0430 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e. <\/p>\n<p>  <\/p>\n<h2 id=\"migracii\">\u041c\u0438\u0433\u0440\u0430\u0446\u0438\u0438<\/h2>\n<p>  <\/p>\n<p>\u0423 Tortoise ORM \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438. \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c \u0437\u0430\u0434\u0430\u0447\u0438 \u0442\u0430\u043a\u043e\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443.<\/p>\n<p>  <\/p>\n<h2 id=\"serializatory\">\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u0435\u0437 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432. \u041d\u0430\u0448\u0435\u043b \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/abondar\/aiohttp-tortoise-boilerplate\" rel=\"nofollow\">https:\/\/github.com\/abondar\/aiohttp-tortoise-boilerplate<\/a>, \u043d\u043e \u0442\u0430\u043c \u0441\u0442\u0430\u0440\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f Tortoise ORM.<br \/>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441 \u043d\u0438\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u0438\u0434\u0438\u043e\u043c\u0430\u0442\u0438\u0447\u043d\u0435\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u041d\u0430\u0434\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c. ORM \u043f\u0440\u0438\u0446\u0435\u043f\u0438\u043b\u0438, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c. \u0410 \u043c\u043e\u0436\u0435\u0442 \u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u043e\u0432 \u0435\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c?<\/p>\n<p>  <\/p>\n<h2 id=\"testy\">\u0422\u0435\u0441\u0442\u044b<\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b. \u041f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c \u0437\u0430\u0434\u0430\u0447\u0438 \u0442\u0435\u0441\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u043e \u043e\u043d\u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u0435\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043f\u0440\u043e\u0444\u0438\u043b\u0435\u0439, \u0441\u0442\u0430\u0442\u0435\u0439 \u0438 \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e. \u041f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e\u0442\u0441\u044f \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0432\u0441\u0435 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043f\u0440\u043e\u0441\u043b\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0435 \u0438\u043c\u044f \u043d\u0430 \u0432\u0435\u043a\u0430 \u0438 \u0442\u044b\u0441\u044f\u0447\u0435\u043b\u0435\u0442\u0438\u044f. \u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.<\/p>\n<\/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\/post\/487610\/\"> https:\/\/habr.com\/ru\/post\/487610\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/487610\/\">\n<h1 id=\"realworld-aiohttp-tortoise-orm\">RealWorld: aiohttp, Tortoise ORM<\/h1>\n<p>  <\/p>\n<p>\u041d\u0430 Real World <a href=\"https:\/\/github.com\/gothinkster\/realworld\" rel=\"nofollow\">https:\/\/github.com\/gothinkster\/realworld<\/a> \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f aiohttp, \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u041e\u043f\u044b\u0442\u043d\u044b\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u043f\u043e\u0445\u043e\u0436\u0435, \u043d\u0435\u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f, \u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u043c \u0432 aiohttp \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e. \u042f \u043d\u0430\u0447\u0430\u043b \u0435\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Tortoise ORM. \u041f\u043e\u043a\u0430 \u043d\u0430\u0447\u0430\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u043f\u044b\u0442\u043d\u044b\u043c aiohttp \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u043a\u0430\u043c.<\/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-298416","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/298416","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=298416"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/298416\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298416"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}