{"id":295102,"date":"2019-11-24T15:00:20","date_gmt":"2019-11-24T15:00:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=295102"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=295102","title":{"rendered":"\u0410\u0434\u043c\u0438\u043d\u043a\u0430 \u0437\u0430 5 \u043c\u0438\u043d\u0443\u0442. \u0424\u0440\u043e\u043d\u0442\u044d\u043d\u0434 \u2014 react-admin, \u0431\u044d\u043a\u044d\u043d\u0434 \u2014 Flask-RESTful"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/477126\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/aw\/hf\/mv\/awhfmvxxvna44qyv3i_vsig0xwi.png\"><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0430\u0434\u043c\u0438\u043d\u043a\u0443, \u0433\u0434\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u043e\u043c \u0431\u0443\u0434\u0435\u0442 <a href=\"https:\/\/marmelab.com\/react-admin\/\">react-admin<\/a>, \u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c <a href=\"https:\/\/flask-restful.readthedocs.io\/en\/latest\/\">Flask-RESTful api<\/a>, \u0442\u043e \u043d\u0438\u0436\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0441\u0442\u0440\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2><font color=\"#cc0000\">\u0411\u044d\u043a\u0435\u043d\u0434 Flask-RESTful api<\/font><\/h2>\n<p>  \u0421\u0430\u043c \u043a\u043e\u0434 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 main.py:<\/p>\n<pre><code class=\"python\">from flask import Flask, request from flask_restful import Resource,  Api from flask_jwt_extended import JWTManager from flask_jwt_extended import create_access_token, jwt_required from flask_cors import CORS  app = Flask(__name__)  app.config['JWT_SECRET_KEY'] = 'my_cool_secret' jwt = JWTManager(app) CORS(app) api = Api(app)   class UserLogin(Resource):     def post(self):         username = request.get_json()['username']         password = request.get_json()['password']         if username == 'admin' and password == 'habr':             access_token = create_access_token(identity={                 'role': 'admin',             }, expires_delta=False)             result = {'token': access_token}             return result         return {'error': 'Invalid username and password'}   class ProtectArea(Resource):     @jwt_required     def get(self):         return {'answer': 42}   api.add_resource(UserLogin, '\/api\/login\/') api.add_resource(ProtectArea, '\/api\/protect-area\/')  if __name__ == '__main__':     app.run(debug=True, host='0.0.0.0') <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0431\u0435\u0436\u0438\u043c\u0441\u044f \u043f\u043e \u043a\u043e\u0434\u0443: <\/p>\n<ul>\n<li>\u0412\u0441\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u043c\u0438\u0440\u043e\u043c \u043d\u0430\u0448 \u0431\u044d\u043a\u044d\u043d\u0434 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c RESTful api, \u0434\u0430\u0436\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0442\u043e\u0436\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443 flask \u0435\u0441\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c: <a href=\"https:\/\/flask-restful.readthedocs.io\/en\/latest\/\">Flask-RESTful api<\/a><\/li>\n<li>\u041c\u043e\u0434\u0443\u043b\u044c <a href=\"https:\/\/flask-jwt-extended.readthedocs.io\/en\/stable\/\">flask_jwt_extended<\/a> \u043d\u0430\u043c \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u0442\u0435\u0445 \u0440\u043e\u0443\u0442\u043e\u0432, \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0438\u0447\u0435\u0433\u043e \u0441\u0430\u043a\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0443\u0442 \u043d\u0435\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a (header) \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 http \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043a\u0435\u043d jwt ( <a href=\"https:\/\/ru.wikipedia.org\/wiki\/JSON_Web_Token\">JSON Web Token<\/a>), \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u044e\u0437\u0435\u0440 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d. <br \/>  \u0412 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 @jwt_required \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439. \u041c\u043e\u0436\u043d\u043e \u0435\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0442\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b API, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u044b. <\/li>\n<li>\u0411\u0435\u0437 <a href=\"https:\/\/flask-cors.readthedocs.io\/en\/latest\/\">flask_cors<\/a> \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443:<br \/>  <code>Access to XMLHttpRequest at 'http:\/\/localhost:5000\/api\/login\/' from origin 'http:\/\/localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.<br \/>  <\/code>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e <a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/HTTP\/CORS\">CORS \u0437\u0434\u0435\u0441\u044c<\/a>.   <\/li>\n<\/ul>\n<p>  \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">python main.py<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u044f \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u043b \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c \u043a \u0430\u0434\u043c\u0438\u043d\u043a\u0435: admin \/ habr.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a flask \u0441\u0442\u0430\u0440\u0442\u0430\u043d\u0443\u043b, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e curl:<\/p>\n<pre><code class=\"bash\">curl -X POST -H \"Content-Type: application\/json\" -d '{\"username\": \"admin\", \"password\": \"habr\"}' localhost:5000\/api\/login\/ <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"bash\">{   \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIU....\" }<\/code><\/pre>\n<p>  \u0417\u043d\u0430\u0447\u0438\u0442 \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043a \u0444\u0440\u043e\u043d\u0442\u0443.<\/p>\n<h2><font color=\"#cc0000\">\u0424\u0440\u043e\u043d\u0442\u044d\u043d\u0434 react-admin<\/font><\/h2>\n<p>  \u041c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f react-admin. \u0417\u0434\u0435\u0441\u044c <a href=\"https:\/\/marmelab.com\/react-admin\/Readme.html\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a>, \u0430 \u0442\u0443\u0442 \u0434\u0435\u043c\u043e \u0432\u0435\u0440\u0441\u0438\u044f:<br \/>  <a href=\"https:\/\/marmelab.com\/react-admin-demo\/#\/login\">https:\/\/marmelab.com\/react-admin-demo\/#\/login<\/a><br \/>  \u041b\u043e\u0433\u0438\u043d: demo<br \/>  \u041f\u0430\u0440\u043e\u043b\u044c: demo<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0430\u0434\u043c\u0438\u043d\u043a\u0443, \u043a\u0430\u043a \u0432 \u0434\u0435\u043c\u043a\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\"> git clone https:\/\/github.com\/marmelab\/react-admin.git &amp;&amp; cd react-admin &amp;&amp; make install    yarn add axios make build make run-demo <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0435\u0435 \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0430\u0448\u0438\u043c \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>admin\/examples\/demo\/src\/authProvider.js<\/code> \u043d\u0430 \u043d\u0438\u0436\u0435\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e, \u0437\u0430 \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u0430\u0434\u043c\u0438\u043d\u043a\u0438 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">admin\/examples\/demo\/src\/authProvider.js<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">import { AUTH_LOGIN, AUTH_LOGOUT, AUTH_ERROR, AUTH_CHECK, AUTH_GET_PERMISSIONS } from 'react-admin'; import axios from 'axios'; import decodeJwt from 'jwt-decode';  export default (type, params) =&gt; {    if (type === AUTH_LOGIN) {     const { username, password } = params;     let data = JSON.stringify({ username, password });      return axios.post('http:\/\/localhost:5000\/api\/login\/', data, {       headers: {         'Content-Type': 'application\/json',       }     }).then(res =&gt; {       if (res.data.error || res.status !== 200) {         throw new Error(res.data.error);       }       else {         const token = res.data.token;         const decodedToken = decodeJwt(token);         const role = decodedToken.identity.role;         localStorage.setItem('token', token);         localStorage.setItem('role', role);         return Promise.resolve();       }     });   }    if (type === AUTH_LOGOUT) {     localStorage.removeItem('token');     localStorage.removeItem('role');     return Promise.resolve();   }    if (type === AUTH_ERROR) {     const { status } = params;     if (status === 401 || status === 403) {       localStorage.removeItem('token');       localStorage.removeItem('role');       return Promise.reject();     }     return Promise.resolve();   }    if (type === AUTH_CHECK) {     return localStorage.getItem('token') ? Promise.resolve() : Promise.reject({ redirectTo: '\/login' });   }    if (type === AUTH_GET_PERMISSIONS) {     const role = localStorage.getItem('role');     return role ? Promise.resolve(role) : Promise.reject();   }  }; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u043f\u0440\u0438\u043a\u043e\u043b\u0430 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u0431\u044d\u043a\u0435\u043d\u0434\u0443, \u043a \u0440\u043e\u0443\u0442\u0443: <code>\/api\/protect-area\/<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u043e\u0442\u043a\u043d\u0435\u043c \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0430\u0434\u043c\u0438\u043d\u043a\u0438, \u0442\u0430\u043c, \u0433\u0434\u0435 \u0431\u043e\u0440\u043e\u0434\u0430\u0442\u044b\u0435 \u043c\u0443\u0436\u0438\u043a\u0438. <\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>react-admin\/examples\/demo\/src\/dashboard\/Welcome.js<\/code> \u043d\u0430 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">admin\/examples\/demo\/src\/dashboard\/Welcome.js<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">import React, { useState, useEffect, useCallback } from 'react'; import axios from 'axios'; import Card from '@material-ui\/core\/Card'; import CardActions from '@material-ui\/core\/CardActions'; import CardContent from '@material-ui\/core\/CardContent'; import CardMedia from '@material-ui\/core\/CardMedia'; import Button from '@material-ui\/core\/Button'; import Typography from '@material-ui\/core\/Typography'; import HomeIcon from '@material-ui\/icons\/Home'; import CodeIcon from '@material-ui\/icons\/Code'; import { makeStyles } from '@material-ui\/core\/styles'; import { useTranslate } from 'react-admin';  const useStyles = makeStyles({   media: {     height: '18em',   }, });  const mediaUrl = `https:\/\/marmelab.com\/posters\/beard-${parseInt(   Math.random() * 10,   10 ) + 1}.jpeg`;  const Welcome = () =&gt; {    const [state, setState] = useState({});   const fetchFlask = useCallback(async () =&gt; {     axios.defaults.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('token');     await axios.get('http:\/\/localhost:5000\/api\/protect-area\/').then(res =&gt; {       const answer = res.data.answer;       setState({ answer });     });   }, []);    useEffect(() =&gt; {     fetchFlask();   }, []); \/\/ eslint-disable-line react-hooks\/exhaustive-deps    const translate = useTranslate();   const classes = useStyles();     return (     &lt;Card&gt;       &lt;CardMedia image={mediaUrl} className={classes.media} \/&gt;       &lt;CardContent&gt;         &lt;Typography variant=\"h5\" component=\"h2\"&gt;           {state.answer}         &lt;\/Typography&gt;         &lt;Typography component=\"p\"&gt;           {translate('pos.dashboard.welcome.subtitle')}         &lt;\/Typography&gt;       &lt;\/CardContent&gt;       &lt;CardActions style={{ justifyContent: 'flex-end' }}&gt;         &lt;Button href=\"https:\/\/marmelab.com\/react-admin\"&gt;           &lt;HomeIcon style={{ paddingRight: '0.5em' }} \/&gt;           {translate('pos.dashboard.welcome.aor_button')}         &lt;\/Button&gt;         &lt;Button href=\"https:\/\/github.com\/marmelab\/react-admin\/tree\/master\/examples\/demo\"&gt;           &lt;CodeIcon style={{ paddingRight: '0.5em' }} \/&gt;           {translate('pos.dashboard.welcome.demo_button')}         &lt;\/Button&gt;       &lt;\/CardActions&gt;     &lt;\/Card&gt;   ); };  export default Welcome; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u0439\u0434\u0435\u043c \u043d\u0430 \u0430\u0434\u0440\u0435\u0441: <\/p>\n<p>  <code>localhost:3000<\/code><br \/>  \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f, \u0432\u0432\u0435\u0434\u044f \u043b\u043e\u0433\u0438\u043d \/ \u043f\u0430\u0441\u0441: admin \/ habr<\/p>\n<p>  \u0418 \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u043d\u043e\u0440\u043c, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c 42 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435.<\/p>\n<p>  \u0422\u0438\u043f\u0430 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ux\/z2\/3s\/uxz23sc5c89tzzbejveivibsvbc.png\"><\/p>\n<h2><font color=\"#cc0000\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e<\/font><\/h2>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043e\u043c\u0438\u043c\u043e Flask-RESTful \u0435\u0441\u0442\u044c \u0435\u0449\u0435 Flask-RESTplus, <a href=\"https:\/\/stackoverflow.com\/questions\/40165665\/flask-restful-vs-flask-restplus\">\u0442\u0443\u0442<\/a> \u043c\u043e\u0436\u043d\u043e \u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u043b\u0438 \u0445\u0443\u0436\u0435<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u043a\u0443 \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435, \u0434\u0430\u043b\u044c\u0448\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c: <code>npm run build<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 flask \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u0442\u0435\u043c\u043f\u043b\u0435\u0439\u0442. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 <a href=\"https:\/\/stackoverflow.com\/questions\/44209978\/serving-a-create-react-app-with-flask\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0418 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 react.<\/li>\n<\/ul>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/477126\/\"> https:\/\/habr.com\/ru\/post\/477126\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/477126\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/aw\/hf\/mv\/awhfmvxxvna44qyv3i_vsig0xwi.png\"><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0430\u0434\u043c\u0438\u043d\u043a\u0443, \u0433\u0434\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u043e\u043c \u0431\u0443\u0434\u0435\u0442 <a href=\"https:\/\/marmelab.com\/react-admin\/\">react-admin<\/a>, \u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u043e\u043c <a href=\"https:\/\/flask-restful.readthedocs.io\/en\/latest\/\">Flask-RESTful api<\/a>, \u0442\u043e \u043d\u0438\u0436\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0441\u0442\u0440\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.  <\/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-295102","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295102","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=295102"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295102\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}