{"id":2393,"date":"2021-07-19T09:15:29","date_gmt":"2021-07-19T09:15:29","guid":{"rendered":"https:\/\/www.bearloga.space\/?page_id=2393"},"modified":"2021-07-19T09:15:30","modified_gmt":"2021-07-19T09:15:30","slug":"mega-uchebnik-flask-chast-ix-razbienie-na-straniczy","status":"publish","type":"page","link":"https:\/\/www.bearloga.space\/en\/mega-uchebnik-flask-chast-ix-razbienie-na-straniczy\/","title":{"rendered":"\u041c\u0435\u0433\u0430-\u0423\u0447\u0435\u0431\u043d\u0438\u043a Flask, \u0427\u0430\u0441\u0442\u044c IX: \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\" id=\"miguel-grinberg\"><em>Miguel Grinberg<\/em><\/h3>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">\u042d\u0442\u043e \u0434\u0435\u0432\u044f\u0442\u044b\u0439 \u0432\u044b\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0438\u0438 Mega-Tutorial Flask, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432\u0430\u043c, \u043a\u0430\u043a \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u043b\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u0430\u0442\u0435\u0439 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438.<br><a href=\"https:\/\/habrahabr.ru\/post\/346306\/\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 1: \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0449\u0435\u0442\u0435 \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u0443\u0440\u0441\u0430, \u044d\u0442\u043e&nbsp;<a href=\"https:\/\/blog.miguelgrinberg.com\/post\/the-flask-mega-tutorial-part-i-hello-world-legacy\" target=\"_blank\" rel=\"noopener\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 2: \u0415\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u0412\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0432\u044b\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0432 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043c\u043e\u0435\u0439(\u041c\u0438\u0433\u0435\u043b\u044f) \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u044d\u0442\u043e\u043c \u0431\u043b\u043e\u0433\u0435, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u0442\u0435 \u0442\u0435\u0440\u043f\u0435\u043d\u0438\u044f \u0434\u043e\u0436\u0438\u0434\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0434\u0435\u043b\u044e \u0441\u0442\u0430\u0442\u044c\u0438, \u044f (\u041c\u0438\u0433\u0435\u043b\u044c \u0413\u0440\u0438\u043d\u0431\u0435\u0440\u0433)\u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0443\u044e \u043a\u043d\u0438\u0433\u0443 \u0438\u043b\u0438 \u0432\u0438\u0434\u0435\u043e. \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435&nbsp;<a href=\"http:\/\/learn.miguelgrinberg.com\/\" target=\"_blank\" rel=\"noopener\">learn.miguelgrinberg.com<\/a>.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412&nbsp;<a href=\"https:\/\/habrahabr.ru\/post\/347450\/\" target=\"_blank\" rel=\"noopener\">\u0433\u043b\u0430\u0432\u0435 8<\/a>&nbsp;\u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b \u00abfollower\u00bb ( \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a ), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u0430\u043a \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430 \u0432 \u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445. \u0418\u043c\u0435\u044f \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u044f \u0433\u043e\u0442\u043e\u0432 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0447\u043d\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u043b\u043e\u0433\u0430\u0445 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u043d\u0430 index \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u044f.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>\u0421\u0441\u044b\u043b\u043a\u0438 GitHub \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u044b:<\/em>&nbsp;<a href=\"https:\/\/github.com\/miguelgrinberg\/microblog\/tree\/v0.9\" target=\"_blank\" rel=\"noopener\">Browse<\/a>,&nbsp;<a href=\"https:\/\/github.com\/miguelgrinberg\/microblog\/archive\/v0.9.zip\" target=\"_blank\" rel=\"noopener\">Zip<\/a>,&nbsp;<a href=\"https:\/\/github.com\/miguelgrinberg\/microblog\/compare\/v0.8...v0.9\" target=\"_blank\" rel=\"noopener\">Diff<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"predstavlenie-soobscheniy-v-blogah\">\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0431\u043b\u043e\u0433\u0430\u0445<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0447\u0435\u0433\u043e-\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e. \u0414\u043e\u043c\u0430\u0448\u043d\u044f\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0441\u043e\u0437\u0434\u0430\u044e \u043a\u043b\u0430\u0441\u0441 \u0444\u043e\u0440\u043c\u044b:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class PostForm(FlaskForm):\n    post = TextAreaField('Say something', validators=&#91;\n        DataRequired(), Length(min=1, max=140)])\n    submit = SubmitField('Submit')<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u0443 \u0444\u043e\u0440\u043c\u0443 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{% extends \"base.html\" %}\n\n{% block content %}\n    &lt;h1&gt;Hi, {{ current_user.username }}!&lt;\/h1&gt;\n    &lt;form action=\"\" method=\"post\"&gt;\n        {{ form.hidden_tag() }}\n        &lt;p&gt;\n            {{ form.post.label }}&lt;br&gt;\n            {{ form.post(cols=32, rows=4) }}&lt;br&gt;\n            {% for error in form.post.errors %}\n            &lt;span style=\"color: red;\"&gt;&#91;{{ error }}]&lt;\/span&gt;\n            {% endfor %}\n        &lt;\/p&gt;\n        &lt;p&gt;{{ form.submit() }}&lt;\/p&gt;\n    &lt;\/form&gt;\n    {% for post in posts %}\n    &lt;p&gt;\n    {{ post.author.username }} says: &lt;b&gt;{{ post.body }}&lt;\/b&gt;\n    &lt;\/p&gt;\n    {% endfor %}\n{% endblock %}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b \u0442\u0435\u043c, \u0447\u0442\u043e \u0431\u044b\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0445. \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u2014 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from app.forms import PostForm\nfrom app.models import Post\n\n@app.route('\/', methods=&#91;'GET', 'POST'])\n@app.route('\/index', methods=&#91;'GET', 'POST'])\n@login_required\ndef index():\n    form = PostForm()\n    if form.validate_on_submit():\n        post = Post(body=form.post.data, author=current_user)\n        db.session.add(post)\n        db.session.commit()\n        flash('Your post is now live!')\n        return redirect(url_for('index'))\n    posts = &#91;\n        {\n            'author': {'username': 'John'},\n            'body': 'Beautiful day in Portland!'\n        },\n        {\n            'author': {'username': 'Susan'},\n            'body': 'The Avengers movie was so cool!'\n        }\n    ]\n    return render_template(\"index.html\", title='Home Page', form=form,\n                           posts=posts)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0438\u043c\u043f\u043e\u0440\u0442: \u043a\u043b\u0430\u0441\u0441\u044b&nbsp;<code>Post<\/code>&nbsp;\u0438&nbsp;<code>PostForm<\/code><\/li><li><code>POST<\/code>-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 \u043e\u0431\u043e\u0438\u0445 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u0445, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b&nbsp;<code>index<\/code>, \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c&nbsp;<code>GET<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b.<\/li><li>\u041b\u043e\u0433\u0438\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0444\u043e\u0440\u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c&nbsp;<code>Post<\/code>&nbsp;\u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li><li>\u0428\u0430\u0431\u043b\u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442&nbsp;<code>form<\/code>&nbsp;\u043a\u0430\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c, \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0440\u044f\u0434 \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0432\u0435\u0431-\u0444\u043e\u0440\u043c. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u044b \u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0432&nbsp;<em>redirect<\/em>&nbsp;\u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443&nbsp;<em>index<\/em>. \u042f \u043c\u043e\u0433 \u0431\u044b \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u0447\u0430\u0441\u0442\u0438&nbsp;<em>template rendering<\/em>, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e \u0443\u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430&nbsp;<em>index<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0418\u0442\u0430\u043a, \u0437\u0430\u0447\u0435\u043c redirect?<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/cb\/ud\/7x\/cbud7xj8sm4rpctv9qprulhyqjg.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u2014 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c&nbsp;<a href=\"https:\/\/youtu.be\/DjVB2P15iUo\" target=\"_blank\" rel=\"noopener\">(<em>response<\/em>) \u043d\u0430 (<em>request<\/em>)<\/a>&nbsp;\u0437\u0430\u043f\u0440\u043e\u0441\u0430&nbsp;<code>POST<\/code>, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u044b \u0441 \u043f\u0435\u0440\u0435\u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u0435\u0439. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043a\u0430\u043a \u0442\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u043e\u0432 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445. \u0412\u0435\u0434\u044c \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u0442\u0435 \u043a\u043d\u043e\u043f\u043a\u0443 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c, \u0432\u0435\u0431-\u0431\u0440\u0430\u0443\u0437\u0435\u0440, \u0432\u044b\u0434\u0430\u0441\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441. \u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441&nbsp;<code>POST<\/code>&nbsp;\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0444\u043e\u0440\u043c\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442, \u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u043e\u0440\u043c\u0443. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e, \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0443\u044e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0435 \u043f\u043e\u0439\u043c\u0443\u0442, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u043e \u0435\u0441\u043b\u0438 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441&nbsp;<code>POST<\/code>&nbsp;\u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435, \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441&nbsp;<code>GET<\/code>, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0432 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f POST-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c, \u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0440\u044e\u043a \u043d\u0435 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u043f\u0430\u0442\u0442\u0435\u0440\u043d&nbsp;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Post\/Redirect\/Get\" target=\"_blank\" rel=\"noopener\">Post\/Redirect\/Get.<\/a>. \u041e\u043d \u0438\u0437\u0431\u0435\u0433\u0430\u0435\u0442 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435\u043f\u0440\u0435\u0434\u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u044b.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prosmotr-soobscheniy-v-blogah\">\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0431\u043b\u043e\u0433\u0430\u0445<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u043f\u0430\u0440\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0431\u043b\u043e\u0433\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. \u042d\u0442\u0438 \u043f\u043e\u0434\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430&nbsp;<em>index<\/em>&nbsp;\u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 Python:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>posts = &#91;\n    { \n        'author': {'username': 'John'}, \n        'body': 'Beautiful day in Portland!' \n    },\n    { \n        'author': {'username': 'Susan'}, \n        'body': 'The Avengers movie was so cool!' \n    }\n]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434&nbsp;<code>followed_posts()<\/code>&nbsp;\u0432 \u043c\u043e\u0434\u0435\u043b\u0438&nbsp;<code>User<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c. \u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u043c\u043e\u0433\u0443 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.route('\/', methods=&#91;'GET', 'POST'])\n@app.route('\/index', methods=&#91;'GET', 'POST'])\n@login_required\ndef index():\n    # ...\n    posts = current_user.followed_posts().all()\n    return render_template(\"index.html\", title='Home Page', form=form,\n                           posts=posts)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041c\u0435\u0442\u043e\u0434&nbsp;<code>followed_posts<\/code>&nbsp;\u043a\u043b\u0430\u0441\u0441\u0430&nbsp;<code>User<\/code>&nbsp;\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430&nbsp;<em>SQLAlchemy<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0437\u0430\u0445\u0432\u0430\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u0437 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u044b\u0437\u043e\u0432&nbsp;<code>all()<\/code>&nbsp;\u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u044f \u043f\u043e\u043b\u0443\u0447\u0430\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0442\u0443, \u0447\u0442\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440. \u042d\u0442\u043e \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"oblegchit-poisk-polzovateley\">\u041e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0447\u0442\u043e, \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0442\u043e \u043a\u0430\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435. \u042f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430\u0434\u043e \u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435\u0439 \u00abExplore\u00bb. \u042d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u0434\u043e\u043c\u0430\u0448\u043d\u044f\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0412\u043e\u0442 \u043d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.route('\/explore')\n@login_required\ndef explore():\n    posts = Post.query.order_by(Post.timestamp.desc()).all()\n    return render_template('index.html', title='Explore', posts=posts)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438? \u0412\u044b\u0437\u043e\u0432&nbsp;<code>render_template()<\/code>&nbsp;\u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d&nbsp;<em>index.html<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u043e \u043e\u0434\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u00abExplore\u00bb \u044f \u043d\u0435 \u0445\u043e\u0447\u0443 \u0438\u043c\u0435\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0431\u043b\u043e\u0433\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u044f&nbsp;<strong>\u043d\u0435<\/strong>&nbsp;\u0432\u043a\u043b\u044e\u0447\u0438\u043b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442&nbsp;<code>form<\/code>&nbsp;\u0432 \u0432\u044b\u0437\u043e\u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0441\u0431\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d\u0430&nbsp;<em>index.html<\/em>, \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0435\u0431-\u0444\u043e\u0440\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0443, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{% extends \"base.html\" %}\n\n{% block content %}\n    &lt;h1&gt;Hi, {{ current_user.username }}!&lt;\/h1&gt;\n    {% if form %}\n    &lt;form action=\"\" method=\"post\"&gt;\n        ...\n    &lt;\/form&gt;\n    {% endif %}\n    ...\n{% endblock %}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u042f \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u0442\u0443 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;a href=\"{{ url_for('explore') }}\"&gt;Explore&lt;\/a&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043f\u043e\u0434\u0448\u0430\u0431\u043b\u043e\u043d&nbsp;<em><code>_post.html<\/code><\/em>, \u0432&nbsp;<a href=\"https:\/\/habrahabr.ru\/post\/346348\/\" target=\"_blank\" rel=\"noopener\">\u0433\u043b\u0430\u0432\u0435 6<\/a>, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u043b\u043e\u0433\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f? \u042d\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0441\u0442\u0430\u043b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u042f \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0434\u0435\u043b\u0430\u044e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u043b\u043e\u0433\u0435 \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0443:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;table&gt;\n    &lt;tr valign=\"top\"&gt;\n        &lt;td&gt;&lt;img src=\"{{ post.author.avatar(36) }}\"&gt;&lt;\/td&gt;\n        &lt;td&gt;\n            &lt;a href=\"{{ url_for('user', username=post.author.username) }}\"&gt;\n                {{ post.author.username }}\n            &lt;\/a&gt;\n            says:&lt;br&gt;{{ post.body }}\n        &lt;\/td&gt;\n    &lt;\/tr&gt;\n&lt;\/table&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0435\u043f\u0435\u0440\u044c \u044f \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u0443\u0431-\u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u043b\u043e\u0433\u0430 \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n{% for post in posts %}\n    {% include '_post.html' %}\n{% endfor %}\n...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u043e\u0436\u0438\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0441 \u0438\u043c\u0435\u043d\u0435\u043c&nbsp;<code>post<\/code>&nbsp;\u0431\u0443\u0434\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0446\u0438\u043a\u043b\u0430 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 index, \u0442\u0430\u043a \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u0438\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c, \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u043b\u043e\u0441\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u043b\u043e\u0433\u0435 \u043e\u0442 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430\u0439\u0442\u0438 \u043d\u043e\u0432\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u0430\u0436\u0430\u0432 \u043d\u0430 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u044f. \u0423\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u0430\u0432\u0434\u0430?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u043c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437, \u0442\u0430\u043a \u0447\u0442\u043e \u0431\u044b \u0432\u044b \u0441\u0430\u043c\u0438 \u0438\u0441\u043f\u044b\u0442\u0430\u043b\u0438 \u044d\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/bp\/rw\/qd\/bprwqdj3eh5me3baxsrgtsruqis.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"delenie-zapisey-v-blogah\">\u0414\u0435\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0431\u043b\u043e\u0433\u0430\u0445<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0431\u044b\u043b\u043e, \u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043d\u0430 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0431\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c. \u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0435\u0441\u0442\u044c \u0442\u044b\u0441\u044f\u0447\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439? \u0418\u043b\u0438 \u043c\u0438\u043b\u043b\u0438\u043e\u043d? \u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u0438 \u043d\u0435\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0427\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. Flask-SQLAlchemy \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0430&nbsp;<code>paginate()<\/code>. \u0415\u0441\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u044f \u043c\u043e\u0433\u0443 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432&nbsp;<code>all()<\/code>&nbsp;\u0432 \u043a\u043e\u043d\u0446\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt;&gt; user.followed_posts().paginate(1, 20, False).items<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041c\u0435\u0442\u043e\u0434&nbsp;<code>paginate<\/code>&nbsp;\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u0437 Flask-SQLAlchemy. \u042d\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0442\u0440\u0435\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 1<\/li><li>\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435<\/li><li>\u0444\u043b\u0430\u0433 \u043e\u0448\u0438\u0431\u043a\u0438. \u0415\u0441\u043b\u0438&nbsp;<code>True<\/code>, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0432\u043d\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430, 404 \u043e\u0448\u0438\u0431\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0443. \u0415\u0441\u043b\u0438&nbsp;<code>False<\/code>, \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432\u043d\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437&nbsp;<code>paginate<\/code>&nbsp;\u2014 \u043e\u0431\u044a\u0435\u043a\u0442&nbsp;<code>Pagination<\/code>. \u0410\u0442\u0440\u0438\u0431\u0443\u0442&nbsp;<code>items<\/code>&nbsp;\u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. \u0412 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 Pagination \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0432\u0435\u0449\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u043e\u0437\u0436\u0435.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430&nbsp;<code>index()<\/code>. \u041c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0435\u0433\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Config(object):\n    # ...\n    POSTS_PER_PAGE = 3<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u0434\u0435\u044f, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u0438 \u00abknobs\u00bb \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u043b\u0438 \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u043e\u0433\u0434\u0430 \u044f \u043c\u043e\u0433\u0443 \u0432\u0441\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432\u043d\u043e\u0441\u0438\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0412 \u0438\u0442\u043e\u0433\u0435 \u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u0447\u0435\u043c \u0442\u0440\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043d\u043e \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0430\u043b\u0435\u0435, \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0435\u043d \u0432 URL-\u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430&nbsp;<em>query string<\/em>&nbsp;\u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430 \u0441\u0442\u0440. 1, \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d. \u0412\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 URL-\u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u043a\u0430\u043a \u044f \u0431\u0443\u0434\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u044d\u0442\u043e:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Page 1, implicit:&nbsp;<em><a href=\"http:\/\/localhost:5000\/index\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost:5000\/index<\/a><\/em><\/li><li>Page 1, explicit:&nbsp;<em><a href=\"http:\/\/localhost:5000\/index?page=1\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost:5000\/index?page=1<\/a><\/em><\/li><li>Page 3:&nbsp;<em><a href=\"http:\/\/localhost:5000\/index?page=3\" target=\"_blank\" rel=\"noopener\">http:\/\/localhost:5000\/index?page=3<\/a><\/em><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u044f \u043c\u043e\u0433\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442&nbsp;<code>request.args<\/code>&nbsp;\u043e\u0431\u044a\u0435\u043a\u0442\u0430 Flask. \u0412\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u044d\u0442\u043e \u0432&nbsp;<a href=\"https:\/\/habrahabr.ru\/post\/346346\/\" target=\"_blank\" rel=\"noopener\">\u0433\u043b\u0430\u0432\u0435 5<\/a>, \u0433\u0434\u0435 \u044f \u0432\u043d\u0435\u0434\u0440\u0438\u043b URL-\u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u0437 Flask-Login, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442, \u043a\u0430\u043a \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0443 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.route('\/', methods=&#91;'GET', 'POST'])\n@app.route('\/index', methods=&#91;'GET', 'POST'])\n@login_required\ndef index():\n    # ...\n    page = request.args.get('page', 1, type=int)\n    posts = current_user.followed_posts().paginate(\n        page, app.config&#91;'POSTS_PER_PAGE'], False)\n    return render_template('index.html', title='Home', form=form,\n                           posts=posts.items)\n\n@app.route('\/explore')\n@login_required\ndef explore():\n    page = request.args.get('page', 1, type=int)\n    posts = Post.query.order_by(Post.timestamp.desc()).paginate(\n        page, app.config&#91;'POSTS_PER_PAGE'], False)\n    return render_template(\"index.html\", title='Explore', posts=posts.items)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 \u044d\u0442\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0434\u0432\u0430 \u043e\u0431\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043b\u0438\u0431\u043e \u0438\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430&nbsp;<code>page<\/code>&nbsp;\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043b\u0438\u0431\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044d\u0442\u043e 1. \u0417\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434&nbsp;<code>paginate()<\/code>&nbsp;\u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438. \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438&nbsp;<code>POSTS_PER_PAGE<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044a\u0435\u043a\u0442&nbsp;<code>app.config<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0433\u043a\u0438 \u044d\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0438 \u043a\u0430\u043a \u043c\u0430\u043b\u043e \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430. \u042f \u043f\u044b\u0442\u0430\u044e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u0443\u044f\u0441\u044c \u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0440\u0443\u0433\u0438\u0445 \u0447\u0430\u0441\u0442\u0438, \u0438 \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0435 \u0438 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043b\u0435\u0433\u0447\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u0430\u0442\u0430\u043b \u0438\u043b\u0438 \u043c\u0435\u043b\u043a\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0430\u043b\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0414\u0432\u0438\u0433\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435! \u0418 \u0432\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u044b\u0442\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0431\u043e\u043b\u0435\u0435 \u0442\u0440\u0435\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u0431\u043b\u043e\u0433\u0435. \u042d\u0442\u043e \u043b\u0435\u0433\u0447\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 (explore page), \u0433\u0434\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043c \u0432\u0438\u0434\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0438, \u0432\u0432\u0435\u0434\u0438\u0442\u0435&nbsp;<code>http:\/\/localhost:5000\/explore?page=2<\/code>&nbsp;\u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"navigaciya-po-stranicam\">\u041d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044f \u043f\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0441\u044b\u043b\u043e\u043a \u0432 \u043d\u0438\u0436\u043d\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0431\u043b\u043e\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0438\/\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u044f \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u043b, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u0432\u044b\u0437\u043e\u0432\u0430&nbsp;<code>paginate()<\/code>&nbsp;\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 Pagination \u0438\u0437 Flask-SQLAlchemy? \u0414\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0430\u0442\u0440\u0438\u0431\u0443\u0442&nbsp;<em>items<\/em>&nbsp;\u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430,<br>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u041d\u043e \u0443 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>has_next: True, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0435\u0441\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430<\/li><li>has_prev: True, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043a\u0443\u0449\u0435\u0439<\/li><li>next_num: \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/li><li>prev_num: \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u0438\u0445 \u0447\u0435\u0442\u044b\u0440\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u043c\u043e\u0433\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b (\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435) \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.route('\/', methods=&#91;'GET', 'POST'])\n@app.route('\/index', methods=&#91;'GET', 'POST'])\n@login_required\ndef index():\n    # ...\n    page = request.args.get('page', 1, type=int)\n    posts = current_user.followed_posts().paginate(\n        page, app.config&#91;'POSTS_PER_PAGE'], False)\n    next_url = url_for('index', page=posts.next_num) \\\n        if posts.has_next else None\n    prev_url = url_for('index', page=posts.prev_num) \\\n        if posts.has_prev else None\n    return render_template('index.html', title='Home', form=form,\n                           posts=posts.items, next_url=next_url,\n                           prev_url=prev_url)\n\n @app.route('\/explore')\n @login_required\n def explore():\n    page = request.args.get('page', 1, type=int)\n    posts = Post.query.order_by(Post.timestamp.desc()).paginate(\n        page, app.config&#91;'POSTS_PER_PAGE'], False)\n    next_url = url_for('explore', page=posts.next_num) \\\n        if posts.has_next else None\n    prev_url = url_for('explore', page=posts.prev_num) \\\n        if posts.has_prev else None\n    return render_template(\"index.html\", title='Explore', posts=posts.items,\n                          next_url=next_url, prev_url=prev_url)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412&nbsp;<code>next_url<\/code>&nbsp;\u0438&nbsp;<code>prev_url<\/code>&nbsp;\u0432 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435 URL-\u0430\u0434\u0440\u0435\u0441, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439&nbsp;<code>url_for()<\/code>, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438. \u0415\u0441\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043a\u043e\u043d\u0446\u043e\u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b&nbsp;<code>has_next<\/code>&nbsp;\u0438\u043b\u0438&nbsp;<code>has_prev<\/code>&nbsp;\u043e\u0431\u044a\u0435\u043a\u0442\u0430&nbsp;<code>Pagination<\/code>&nbsp;\u0431\u0443\u0434\u0443\u0442&nbsp;<code>False<\/code>, \u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0441\u044b\u043b\u043a\u0430 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u200b\u200b\u043d\u0430&nbsp;<code>None<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u041e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438&nbsp;<code>url_for()<\/code>, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u0443\u043c\u043e\u043b\u0447\u0430\u043b \u0440\u0430\u043d\u0435\u0435, \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u043b\u044e\u0431\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430, \u0438 \u0435\u0441\u043b\u0438 \u0438\u043c\u0435\u043d\u0430 \u044d\u0442\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u044b \u0432 URL-\u0430\u0434\u0440\u0435\u0441\u0435, \u0442\u043e\u0433\u0434\u0430 Flask \u0431\u0443\u0434\u0435\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0438\u0445 \u0432 URL-\u0430\u0434\u0440\u0435\u0441 \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u0432\u044f\u0437\u0438 \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435&nbsp;<em>index.html<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0438\u0445 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043f\u0440\u044f\u043c\u043e \u043f\u043e\u0434 \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n{% for post in posts %}\n    {% include '_post.html' %}\n{% endfor %}\n{% if prev_url %}\n&lt;a href=\"{{ prev_url }}\"&gt;Newer posts&lt;\/a&gt;\n{% endif %}\n{% if next_url %}\n&lt;a href=\"{{ next_url }}\"&gt;Older posts&lt;\/a&gt;\n{% endif %}\n...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u042d\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0438\u0436\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043a\u0430\u043a \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b index, \u0442\u0430\u043a \u0438 \u043f\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u044b\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c. \u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u0430 \u043a\u0430\u043a \u00ab\u041d\u043e\u0432\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u00bb (&#8220;Newer posts&#8221;), \u0438 \u043e\u043d\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 (\u0438\u043c\u0435\u0439\u0442\u0435 \u0432 \u0432\u0438\u0434\u0443, \u0447\u0442\u043e \u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u2014 \u0441 \u043d\u043e\u0432\u0435\u0439\u0448\u0438\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u0442\u043e\u0440\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u0430 \u043a\u0430\u043a \u00ab\u0421\u0442\u0430\u0440\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u00bb (&#8220;Older posts&#8221;) \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u0430\u044f-\u043b\u0438\u0431\u043e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u2014&nbsp;<code>None<\/code>, \u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0447\u0435\u0440\u0435\u0437 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3b\/w3\/zq\/3bw3zqyb7q-jvr0p5reitn2oxjo.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"razbienie-stranicy-profilya-polzovatelya\">\u0420\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b index \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430 \u043f\u0440\u043e\u0444\u0438\u043b\u044f. \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 index.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u042f \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@app.route('\/user\/&lt;username&gt;')\n@login_required\ndef user(username):\n    user = User.query.filter_by(username=username).first_or_404()\n    page = request.args.get('page', 1, type=int)\n    posts = user.posts.order_by(Post.timestamp.desc()).paginate(\n        page, app.config&#91;'POSTS_PER_PAGE'], False)\n    next_url = url_for('user', username=user.username, page=posts.next_num) \\\n        if posts.has_next else None\n    prev_url = url_for('user', username=user.username, page=posts.prev_num) \\\n        if posts.has_prev else None\n    return render_template('user.html', user=user, posts=posts.items,\n                           next_url=next_url, prev_url=prev_url)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435&nbsp;<code>user.posts<\/code>&nbsp;\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d SQLAlchemy \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f&nbsp;<code>db.relationship()<\/code>&nbsp;\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 User. \u042f \u0432\u043e\u0437\u044c\u043c\u0443 \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044e&nbsp;<code>order_by()<\/code>, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0435 \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u044e \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0443 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 index \u0438 explore. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439&nbsp;<code>url_for()<\/code>, \u043d\u0443\u0436\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0435&nbsp;<code>username<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u044d\u0442\u043e username \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 URL-\u0430\u0434\u0440\u0435\u0441\u0430.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435&nbsp;<em>user.html<\/em>&nbsp;\u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0430 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n{% for post in posts %}\n    {% include '_post.html' %}\n{% endfor %}\n{% if prev_url %}\n&lt;a href=\"{{ prev_url }}\"&gt;Newer posts&lt;\/a&gt;\n{% endif %}\n{% if next_url %}\n&lt;a href=\"{{ next_url }}\"&gt;Older posts&lt;\/a&gt;\n{% endif %}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0440\u0430\u0437\u0431\u0438\u0432\u043a\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043b\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438&nbsp;<code>POSTS_PER_PAGE<\/code>&nbsp;\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Config(object):\n    # ...\n    POSTS_PER_PAGE = 25<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Miguel Grinberg \u042d\u0442\u043e \u0434\u0435\u0432\u044f\u0442\u044b\u0439 \u0432\u044b\u043f\u0443\u0441\u043a \u0441\u0435\u0440\u0438\u0438 Mega-Tutorial Flask, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432\u0430\u043c, \u043a\u0430\u043a \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0414\u043b\u044f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[94],"tags":[],"class_list":["post-2393","page","type-page","status-publish","hentry","category-flask"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/pages\/2393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/comments?post=2393"}],"version-history":[{"count":0,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/pages\/2393\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/media?parent=2393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/categories?post=2393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bearloga.space\/en\/wp-json\/wp\/v2\/tags?post=2393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}