{"id":1260,"date":"2023-08-16T21:30:43","date_gmt":"2023-08-16T16:00:43","guid":{"rendered":"https:\/\/geekpython.in\/?p=1260"},"modified":"2024-03-01T17:08:45","modified_gmt":"2024-03-01T11:38:45","slug":"structure-flask-app-with-blueprint","status":"publish","type":"post","link":"https:\/\/geekpython.in\/structure-flask-app-with-blueprint","title":{"rendered":"Structuring Flask App with Blueprint &#8211; How to Use"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"introduction\">Introduction<\/h1>\n\n\n\n<p>Large applications can become complex and difficult to manage due to the presence of numerous components and intricate structures.<\/p>\n\n\n\n<p>Flask blueprints help in organizing large applications into smaller, manageable components, leading to enhanced maintainability of the application.<\/p>\n\n\n\n<p>Blueprints can contain views, templates, and static files for various components, similar to the structure of a typical Flask application. These blueprints can be registered with the Flask app to integrate them into the application.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Flask App Structure<\/h1>\n\n\n\n<p>If you&#8217;ve used the Flask framework before, you might structure your Flask application as follows:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tex decode:true \">.\n\u251c\u2500\u2500 app.py\n\u251c\u2500\u2500 static\/\n\u2514\u2500\u2500 templates\/\n    \u2514\u2500\u2500 index.html<\/pre><\/div>\n\n\n\n<p>After you&#8217;ve created the structure for your app, you&#8217;ll add some code to the <code>app.py<\/code> file.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \" title=\"app.py\" ># app.py\nfrom flask import Flask, render_template\n\napp = Flask(__name__)\n\n@app.route(\"\/\")\ndef home():\n    return render_template(\"index.html\")<\/pre><\/div>\n\n\n\n<p>In smaller projects, defining views within the main file may not pose a significant problem. However, in more complex projects, when you need to create routes for various components such as user management, admin functions, profiles, voting, and more, organizing these routes within a single file can become challenging. This can lead to poor code maintainability and make the project harder to manage.<\/p>\n\n\n\n<p>This is precisely where blueprints prove valuable, as they allow you to structure your application into smaller components, enhancing maintainability.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Creating the Blueprint<\/h1>\n\n\n\n<p>Add the following code to a new Python file at the root level, <code>blueprint.py<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python mark:1,5,9 decode:true \" title=\"blueprint.py\" >from flask import Blueprint\n\nbp = Blueprint(\"blueprint\", __name__)\n\n@bp.route(\"\/\")\ndef home():\n    return \"&lt;h1&gt;Hello&lt;\/h1&gt;\"\n\n@bp.route(\"\/user\")\ndef user_info():\n    return \"&lt;h1&gt;User Info&lt;\/h1&gt;\"<\/pre><\/div>\n\n\n\n<p>The code imports the <code>Blueprint<\/code> class from the <code>flask<\/code> which will help in defining the routes.<\/p>\n\n\n\n<p>The instance of the <code>Blueprint<\/code> is created by calling <code>Blueprint(\"blueprint\", __name__)<\/code> and passed in two arguments, first, <code>\"blueprint\"<\/code>, is the Blueprint&#8217;s name, and the second, <code>__name__<\/code>, is the Blueprint&#8217;s import name. After that, the instance is saved in the <code>bp<\/code> variable.<\/p>\n\n\n\n<p>The routes are defined using the Blueprint instance (<code>bp<\/code>) in a similar manner to how routes are defined using the Flask application instance (<code>app<\/code>).<\/p>\n\n\n\n<p>The <code>@bp.route()<\/code> decorators are used to associate URL routes with the view functions defined within the blueprint. The <code>home()<\/code> function is associated with the root URL (<code>\"\/\"<\/code>), and the <code>user_info()<\/code> function is associated with the <code>\"\/user\"<\/code> URL.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Registering the Blueprint<\/h1>\n\n\n\n<p>A blueprint is similar to a Flask app, but it is not an app, instead, the blueprint must be registered within the Flask app to extend its functionality.<\/p>\n\n\n\n<p>Navigate to the main Flask app created in the <code>app.py<\/code> Python file and register the above-created blueprint.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python mark:2,7 decode:true \" title=\"app.py\">from flask import Flask\nfrom blueprint import bp\n\n# Flask app instance\napp = Flask(__name__)\n\napp.register_blueprint(bp)\n\nif __name__ == \"__main__\":\n    app.run(debug=True)<\/pre><\/div>\n\n\n\n<p>The code imports the Blueprint instance, <code>bp<\/code>, from the <code>blueprint<\/code> module (<code>blueprint.py<\/code>), and this import includes all of the blueprint&#8217;s routes and views.<\/p>\n\n\n\n<p>The <code>register_blueprint()<\/code> method is then used to register the blueprint instance (<code>bp<\/code>) with the Flask app instance (<code>app<\/code>).<\/p>\n\n\n\n<p>If you run the app, you can access the routes defined within the blueprint.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Mounting Blueprints at Different Locations<\/h1>\n\n\n\n<p>Blueprints can be attached to a certain URL path that can be prefixed with all of the routes defined within the blueprint.<\/p>\n\n\n\n<p>You can make this happen by using the <code>url_prefix<\/code> parameter while registering the blueprint using the <code>register_blueprint()<\/code> method in the Flask app.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python mark:8 decode:true \" title=\"app.py\" ># app.py\nfrom flask import Flask\nfrom blueprint import bp\n\n# Flask app instance\napp = Flask(__name__)\n\napp.register_blueprint(bp, url_prefix=\"\/demo\")\n\nif __name__ == \"__main__\":\n    app.run(debug=True)<\/pre><\/div>\n\n\n\n<p>The <code>url_prefix<\/code> is now <code>\"\/demo\"<\/code>. This means that the routes within the blueprint (<code>\"\/\"<\/code> and <code>\"\/user\"<\/code>) can be accessed by adding <code>\"\/demo\"<\/code> at the beginning of their URL paths.<\/p>\n\n\n\n<p>The complete URL of the (<code>\"\/\"<\/code>) route is changed to <code>\"\/demo\/\"<\/code> for the <code>home()<\/code> function. Also, the complete URL of the <code>\"\/user\"<\/code> route will now be <code>\"\/demo\/user\"<\/code> for the <code>user_info()<\/code> function.<\/p>\n\n\n\n<p>You can set the <code>url_prefix<\/code> while making the Blueprint instance. The Blueprint class offers a <code>url_prefix<\/code> parameter, and the provided code example demonstrates its usage.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python mark:4 decode:true \" title=\"blueprint.py\" ># blueprint.py\nfrom flask import Blueprint\n\nbp = Blueprint(\"blueprint\", __name__, url_prefix=\"\/sample\")<\/pre><\/div>\n\n\n\n<p>The URL path for the (<code>\"\/\"<\/code>) route will become <code>\"\/sample\/\"<\/code>. Likewise, the URL path for the <code>\"\/user\"<\/code> route will change to <code>\"\/sample\/user\"<\/code>.<\/p>\n\n\n\n<p><strong>Note:<\/strong> If you set the <code>url_prefix<\/code> parameter inside the blueprint, avoid setting it again during the blueprint registration. Doing so will overwrite the blueprint&#8217;s URL prefix.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Caution:<\/p>\n\n\n\n<p>If you set url_prefix in the blueprint and then set it again while registering the blueprint within the app, the latter will overwrite the former.<\/p>\n<\/blockquote>\n\n\n\n<h1 class=\"wp-block-heading\">Templates and Static Folders<\/h1>\n\n\n\n<p>You have several options for organizing your app using blueprints.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tex decode:true \" >.\n\u2514\u2500\u2500 app\/\n    \u251c\u2500\u2500 __init__.py\n    \u251c\u2500\u2500 admin\/\n    \u2502   \u251c\u2500\u2500 __init__.py\n    \u2502   \u251c\u2500\u2500 routes.py\n    \u2502   \u251c\u2500\u2500 static\/\n    \u2502   \u2514\u2500\u2500 templates\/\n    \u251c\u2500\u2500 user\/\n    \u2502   \u251c\u2500\u2500 __init__.py\n    \u2502   \u251c\u2500\u2500 routes.py\n    \u2502   \u251c\u2500\u2500 static\/\n    \u2502   \u2514\u2500\u2500 templates\/\n    \u2514\u2500\u2500 models.py<\/pre><\/div>\n\n\n\n<p>If your project&#8217;s structure aligns with the example above, you&#8217;ll have to indicate the locations of <strong>templates<\/strong> and <strong>static<\/strong> folders within your <code>Blueprint<\/code>.<\/p>\n\n\n\n<p>The <code>Blueprint<\/code> class gives you parameters, <code>templates_folder<\/code> and <code>static_folder<\/code>, which allow you to define the exact path (either absolute or relative) to the blueprint&#8217;s <strong>templates<\/strong> and <strong>static<\/strong> folder when creating an instance of the <code>Blueprint<\/code> class.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python mark:6-7 decode:true \" ># admin\/routes.py\nfrom flask import Blueprint\n\nadmin_bp = Blueprint(\"admin_blueprint\",\n                     __name__,\n                     template_folder=\"templates\",\n                     static_folder=\"static\")<\/pre><\/div>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python mark:6-7 decode:true \" ># user\/routes.py\nfrom flask import Blueprint\n\nuser_bp = Blueprint(\"user_blueprint\",\n                    __name__,\n                    template_folder=\"templates\",\n                    static_folder=\"static\")<\/pre><\/div>\n\n\n\n<p>Both <code>\"admin_bp\"<\/code> and <code>\"user_bp\"<\/code> blueprints have their own directories for templates and static files. This separation ensures that their respective templates and assets are kept separate from other parts of the app, maintaining isolation and organization.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Avoid Template Name Clashes<\/h1>\n\n\n\n<p>When you&#8217;re designing blueprints for different parts of your application, the arrangement of your project holds significance. For instance, referring to the layout mentioned above, duplicating HTML filenames in the <code>admin\/templates<\/code> and <code>user\/templates<\/code> directories can lead to a name clash.<\/p>\n\n\n\n<p>The Flask application searches for templates in the <code>\"templates\"<\/code> directory. If there are duplicate template file paths across different blueprints, the one that takes precedence depends on the order of blueprint registration. The one registered later will override the earlier one.<\/p>\n\n\n\n<p>To avoid potential issues, you can shape the project layout in the following manner:<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:tex decode:true \" >.\n\u2514\u2500\u2500 app\/\n    \u251c\u2500\u2500 app.py\n    \u251c\u2500\u2500 models.py\n    \u251c\u2500\u2500 admin\/\n    \u2502   \u251c\u2500\u2500 __init__.py\n    \u2502   \u251c\u2500\u2500 routes.py\n    \u2502   \u251c\u2500\u2500 static\/\n    \u2502   \u2514\u2500\u2500 templates\/\n    \u2502       \u2514\u2500\u2500 admin\/\n    \u2502           \u2514\u2500\u2500 index.html\n    \u2514\u2500\u2500 user\/\n        \u251c\u2500\u2500 __init__.py\n        \u251c\u2500\u2500 routes.py\n        \u251c\u2500\u2500 static\/\n        \u2514\u2500\u2500 templates\/\n            \u2514\u2500\u2500 user\/\n                \u2514\u2500\u2500 index.html<\/pre><\/div>\n\n\n\n<p>Alternatively, you can assign distinct names to the templates.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Template Routing with Blueprints<\/h1>\n\n\n\n<p>Template routing with blueprints is distinct from the conventional approach. It involves a specific format where the blueprint name is added as a prefix to the associated view function.<\/p>\n\n\n\n<p>As an example, if your blueprint is named <code>admin_blueprint<\/code> and includes a view function named <code>home()<\/code>, then the format becomes <code>admin_blueprint.home<\/code>.<\/p>\n\n\n\n<p><strong>admin\/templates\/admin\/index.html<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:xhtml decode:true \" >&lt;a href=\"{{ url_for('user_blueprint.home') }}\"&gt;User&lt;\/a&gt;<\/pre><\/div>\n\n\n\n<p>The link mentioned above points to the route connected with the <code>home()<\/code> function in the <code>user_blueprint<\/code>. The <code>url_for()<\/code> function dynamically produces a URL for the <code>user_blueprint.home<\/code> route.<\/p>\n\n\n\n<p><strong>user\/templates\/user\/index.html<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:xhtml decode:true \" >&lt;a href=\"{{ url_for('admin_blueprint.home') }}\"&gt;Admin&lt;\/a&gt;<\/pre><\/div>\n\n\n\n<p>Likewise, the situation is identical to the link mentioned earlier. It leads to the route linked with the <code>home()<\/code> function in the <code>admin_blueprint<\/code>. The <code>url_for()<\/code> function dynamically generates a URL for the <code>admin_blueprint.home<\/code> route.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>Including CSS Files with Blueprints: Creating URLs for Static Assets<\/strong><\/h1>\n\n\n\n<p>The procedure is quite similar to what you did with templates. To include CSS files within the HTML template, you should construct a URL that directs to the CSS file situated in the specified static folder of the blueprint.<\/p>\n\n\n\n<p>As an example, the method to link the <code>\"style.css\"<\/code> file found in the <code>static<\/code> directory of the <code>\"admin_blueprint\"<\/code> blueprint would be <code>url_for('admin_blueprint.static', filename='style.css')<\/code>.<\/p>\n\n\n\n<p>Note: You must indicate the directory path where static files (CSS, JavaScript, images, etc.) are situated for this blueprint. This is achieved using the <code>static_folder<\/code> parameter.<\/p>\n\n\n\n<p><strong>admin\/templates\/admin\/index.html<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:xhtml decode:true \" >&lt;link rel=\"stylesheet\" href=\"{{ url_for('admin_blueprint.static', filename='style.css') }}\"&gt;<\/pre><\/div>\n\n\n\n<p>This HTML code snippet above uses the <code>url_for()<\/code> function to generate a URL that points to the <strong>&#8220;style.css&#8221;<\/strong> static file linked to the <code>admin_blueprint<\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Custom URL Path for Static Files<\/h1>\n\n\n\n<p>Flask <code>Blueprint<\/code> provides a <code>static_url_path<\/code> parameter that provides flexibility to define a custom URL prefix for the static files (CSS, JavaScript, images, etc.) associated with the <code>Blueprint<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python mark:8 decode:true \" ># admin\/routes.py\nfrom flask import Blueprint\n\nadmin_bp = Blueprint(\"admin_blueprint\",\n                     __name__,\n                     template_folder=\"templates\",\n                     static_folder='static',\n                     static_url_path='\/admin')<\/pre><\/div>\n\n\n\n<p>The <code>static_url_path<\/code> is set as <code>\"admin\"<\/code>, effectively making the static files within the <code>admin_blueprint<\/code> accessible under the <code>admin\/<\/code> URL path.<\/p>\n\n\n\n<p>Now you can directly include static files (CSS, JavaScript, images, etc) by specifying the static URL path.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Including Static Files using Static URL Path<\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:xhtml decode:true \" >&lt;link rel=\"stylesheet\" href=\"admin\/style.css\"&gt;\n\n&lt;!--Body Section--&gt;\n&lt;img src=\"admin\/partners.png\"&gt;<\/pre><\/div>\n\n\n\n<p>The complete webpage would look like the image shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"681\" height=\"698\" src=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/image.png\" alt=\"Flask webpage serving using Admin blueprint\" class=\"wp-image-1390\" srcset=\"https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/image.png 681w, https:\/\/geekpython.in\/wp-content\/uploads\/2023\/08\/image-293x300.png 293w\" sizes=\"auto, (max-width: 681px) 100vw, 681px\" \/><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">Conclusion<\/h1>\n\n\n\n<p>A Flask Blueprint is used as an extension for a Flask app, and it serves the purpose of organizing large and complex applications into smaller, more manageable components.<\/p>\n\n\n\n<p>Let&#8217;s recall what you&#8217;ve seen in this tutorial:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What is Blueprint in Flask<\/li>\n\n\n\n<li>Creating and Registering a Blueprint<\/li>\n\n\n\n<li>Template routing with Blueprint<\/li>\n\n\n\n<li>Including static files with Blueprint<\/li>\n\n\n\n<li>Custom URL path for static assets<\/li>\n<\/ul>\n\n\n\n<p>Reference: <a href=\"https:\/\/flask.palletsprojects.com\/en\/2.3.x\/blueprints\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/flask.palletsprojects.com\/en\/2.3.x\/blueprints\/<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83c\udfc6<strong>Other articles you might be interested in if you liked this one<\/strong><\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/render-images-from-flask\">Upload and display images on the frontend using Flask in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/flask-app-for-image-recognition\">Building a Flask image recognition webapp using a deep learning model<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/connect-sqlite-database-with-flask-app\">How to connect the SQLite database with Flask app using Python<\/a>?<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/database-in-appwrite-using-python\">How to create a database in Appwrite using Python<\/a>?<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/merging-tailwindcss-into-flask-apps\">How to Integrate TailwindCSS with Flask<\/a>?<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/geekpython.in\/context-managers-and-python-with-statement\">What is context manager and how to use them using with statement<\/a>?<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>That&#8217;s all for now<\/strong><\/p>\n\n\n\n<p><strong>Keep Coding\u270c\u270c<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Large applications can become complex and difficult to manage due to the presence of numerous components and intricate structures. Flask blueprints help in organizing large applications into smaller, manageable components, leading to enhanced maintainability of the application. Blueprints can contain views, templates, and static files for various components, similar to the structure of a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1395,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[5,2],"tags":[36,12,31],"class_list":["post-1260","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-flask","category-python","tag-flask","tag-python","tag-python3","entry","has-media"],"_links":{"self":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/comments?post=1260"}],"version-history":[{"count":13,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1260\/revisions"}],"predecessor-version":[{"id":1396,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1260\/revisions\/1396"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media\/1395"}],"wp:attachment":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media?parent=1260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/categories?post=1260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/tags?post=1260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}