

{"id":113243,"date":"2023-07-22T19:07:38","date_gmt":"2023-07-22T13:37:38","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=113243"},"modified":"2023-07-22T19:07:25","modified_gmt":"2023-07-22T13:37:25","slug":"flask-templates","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/flask-templates\/","title":{"rendered":"Template in Flask"},"content":{"rendered":"<p>In this article, we will learn about template in flask Let&#8217;s start!!<\/p>\n<h3>What are templates?<\/h3>\n<p>Templates are scripts that include stand ins for data streams in addition to static data. To create the finished document, a theme is presented with the required data. To render templates, Flask makes use of the Jinja template library. You will utilize templates in your application to render HTML that the user&#8217;s browser will see. Jinja is set up in Flask to automatically escape any data rendered in HTML layouts.<\/p>\n<p>Flask is a compact Py web platform that provides helpful tools and functionalities for developing web applications. A back-end web framework built on the programming language Python is called Flask. In essence, it enables the development of web applications using Pythonic syntax and ideas. We may incorporate Libraries and services into our web applications using Flask. We can put up a webserver using Flask to load some simple HTML templates and the Jinja2 templating syntax. We&#8217;ll look at how to render HTML layouts in Flask in this tutorial.<\/p>\n<p>To render HTML templates in Flask, you can employ the Jinja templating language. A file that contains both static and dynamic content is known as a template. With Jinja, you may answer to user requests with HTML templates that contain numerous capabilities not found in ordinary HTML, such as parameters, if clauses, for cycles, filtering, and theme inheritance. Examples of such requests might be for an index page or a login page. You can effectively create simple-to-maintain HTML pages thanks to these capabilities. To combat Cross-Site Scripting (XSS) threats, Jinja now automatically escapes HTML.<\/p>\n<p>The result of a procedure that is linked to a specific URL may be returned as HTML. For instance, the hello() method inside the accompanying script will render &#8220;Hello World&#8221; with an associated h1&gt; tag.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from flask import Flask\r\n\r\napp = Flask(__name__)\r\n\r\n@app.route('\/')\r\ndef index():\r\n    return '&lt;html&gt;&lt;body&gt;&lt;h2&gt;Welcome to my Flask app!&lt;\/h2&gt;&lt;\/body&gt;&lt;\/html&gt;'\r\n\r\nif __name__ == '__main__':\r\n    app.run(debug=True)\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p>Welcome to my Flask app!<\/p>\n<p>However, it can be difficult to generate Html page from Python code, especially when changeable information and other Python language features such predicate or loops are required. This would necessitate repeated HTML escaping.<\/p>\n<p>Here, one can benefit from Flask&#8217;s foundational Jinja2 template engine. The render template() function allows an HTML file to be rendered instead of hardcoded HTML being returned.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from flask import Flask, render_template\r\n\r\napp = Flask(__name__)\r\n\r\n@app.route('\/')\r\ndef demo():\r\n   return render_template('HiWorld.html')\r\n\r\nif __name__ == '__main__':\r\n   app.run(debug=True)\r\n<\/pre>\n<p>To show the output of the code, you would need to create an HTML template file called HiWorld.html in the same directory as your Flask application file<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;title&gt;Hi World!&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h1&gt;Hello, World!&lt;\/h1&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h3>Generating additional HTML files<\/h3>\n<p>Rather than hardcoding the Content in the view function, Flask makes it possible to display the outside HTML file. Here, we may benefit from the flask&#8217;s underlying jinja2 template engine.<br \/>\nTo generate the external Html document that will be given as the result from the view function, utilise the render template() function that Flask offers.<\/p>\n<p>Consider the case below.<\/p>\n<p>Let&#8217;s first generate an HTML file with the name demo.html in order to produce a Html document from the view function.<\/p>\n<p><strong>Demo.html<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;title&gt;Windows&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h1&gt;Hello, World!&lt;\/h1&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Flask.py<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from flask import Flask, render_template\r\n\r\napp = Flask(__name__)\r\n\r\n@app.route('\/')\r\ndef content():\r\n    return render_template('Demo.html')\r\n\r\n\r\nif __name__ == '__main__':\r\n    app.run(debug=True)\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p>Hello, World!<\/p>\n<p><strong>This message is displayed in large font because it&#8217;s wrapped in an &lt;h1&gt; tag in the Demo.html template file.<\/strong><\/p>\n<h3>Building and Developing Template in Flask<\/h3>\n<p>Now that we have a means to really inherit some templates rather than just reuse them, we can accomplish this by building blocks in Jinja. With the name supplied to the block, we may use it in other templates and they enable us to create template blocks.<\/p>\n<p>Consequently, let&#8217;s build a block in our &#8220;index.html&#8221; file and reuse it. To do this, we start the block with &#8220;% block name&gt;%&#8221; (where name = &#8220;body&#8221;); this will copy anything beyond it and save it in a synthetic block of template. To end the block, we simply type &#8220;% endblock%,&#8221; which will duplicate everything below it.<\/p>\n<p><strong>demo.html<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;title&gt;Testing Flask&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h2&gt;Welcome!&lt;\/h2&gt;\r\n    &lt;h4&gt;Rendering Templates&lt;\/h4&gt;\r\n    &lt;a href=\"{{ url_for('home') }}\"&gt;Home&lt;\/a&gt;\r\n    &lt;a href=\"{{ url_for('index') }}\"&gt;Index&lt;\/a&gt;\r\n    {% block body %}\r\n        &lt;p&gt;Hello, world!&lt;\/p&gt;\r\n    {% endblock %}\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Because everything below the &#8220;% endblock%&#8221; and all above the &#8220;% block body%&#8221; tags is copied, we are excluding the &#8220;p&gt;&#8221; tags in this instance. Additionally, we employ absolute urls. The hyperlinks are variable and rather simple to comprehend. As component of Jinja2 syntax, we wrap them with &#8221; &#8220;. We only need to supply the function&#8217;s name as a text as an argument to have the url for function reverse the full URL for us.<\/p>\n<p>Create the template &#8220;home.html&#8221; with the following information so that we can reuse the constructed block &#8220;body&#8221; in future templates:<\/p>\n<p>folder1\/hello.html<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">{% extends 'index.html' %}\r\n{% block body %}\r\n&lt;p&gt;Welcome to the World !!!&lt;\/p&gt;\r\n{% endblock %}\r\n<\/pre>\n<p>Even though it appears to be two lines, this will also extend (but will not include) the demo.html. This is accomplished by parsing the section into the aforementioned template using the %extends file.html&gt;% tags. Then, we may add whatever we want. If you use the include tag, the replacement paragraph won&#8217;t appear in the right spot on the index.html page. Even though it will produce an erroneous html file, the browser is so forgiving that you won&#8217;t know unless you check the source that was generated. It is necessary to properly nest the body text.<\/p>\n<p>The only remaining component is the path to home.html, so let&#8217;s also create it. Let&#8217;s update the &#8220;server.py file&#8221; with a new route.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">@app.route(\"\/hello\")\r\ndef hello():\r\n    return render_template(\"hello.html\")\r\n<\/pre>\n<h3>Delimiters in Flask<\/h3>\n<p>To enable dynamic data representation in HTML, the Jinga 2 template engine offers a number of delimiters that can be employed.Characters provided by the templates system for variables and expressions are replaced by their real values when the template is rendered.<\/p>\n<p>The following delimiters are available from the jinga2 templates engine to escape from HTML.<\/p>\n<ul>\n<li>{% &#8230; %} for lines<\/li>\n<li>{{ &#8230; }} to display to the template result for expressions<\/li>\n<li>{# &#8230; #} for the remarks that aren&#8217;t printed using the template<\/li>\n<li># &#8230; ## for lines of statements<\/li>\n<\/ul>\n<p>Take a look at the example below, where the {{&#8230;}} delimiter is used to display the variable portion of the URL in the HTML script.<\/p>\n<p><strong>demo.html<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;title&gt;Hello World!&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h1&gt;Hello, {{ name }}!&lt;\/h1&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Server.py<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from flask import Flask, render_template\r\n\r\napp = Flask(__name__)\r\n\r\n@app.route('\/user\/&lt;u_name&gt;')\r\ndef index(u_name):\r\n    return render_template('demo.html', name=u_name)\r\n\r\nif __name__ == '__main__':\r\n    app.run(debug=True)\r\n<\/pre>\n<h3>Template Logic Inference<\/h3>\n<p>For loops and if conditions are two ways to introduce logic into templates. This is really a fantastic feature to use. Without too much difficulty, we can make some fantastic dynamic templates. Let&#8217;s attempt rendering a list on an HTML template using Python.<\/p>\n<p>For this, we&#8217;ll construct a new route at &#8220;\/about,&#8221; which will connect to the method about, which generates the template &#8220;about.html,&#8221; but we&#8217;ll also add a few extra things before the function returns. We&#8217;ll make a list of fictitious strings and parse them before passing them to a render template method.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">from flask import Flask, render_template\r\n\r\napp = Flask(__name__)\r\n\r\n@app.route(\"\/test\")\r\ndef about():\r\n    social_sites = ['Twitter', 'Instagram', 'Facebook', 'WhatsApp']\r\n    return render_template(\"about.html\", sites=social_sites)\r\n\r\nif __name__ == '__main__':\r\n    app.run(debug=True)\r\n<\/pre>\n<p>In order to link the about function to the route, we constructed the route at &#8220;\/test&#8221;. You can call them anything you like as long as you continue to include that title in the designs. Inside that function, we first create the list &#8220;Sites&#8221; with some dummy strings, and then, as we return, we parse them as sites. We&#8217;ll start by generating the &#8220;about.html&#8221; template and filling it with the information below.<\/p>\n<p><strong>test.html<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">{% extends 'base.html' %}\r\n\r\n{% block content %}\r\n    &lt;h1&gt;List of Social Sites&lt;\/h1&gt;\r\n    &lt;ul&gt;\r\n        {% for site in sites %}\r\n            &lt;li&gt;{{ site }}&lt;\/li&gt;\r\n        {% endfor %}\r\n    &lt;\/ul&gt;\r\n{% endblock %}\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p>List of Social Sites<br \/>\n&#8211; Twitter<br \/>\n&#8211; Instagram<br \/>\n&#8211; Facebook<br \/>\n&#8211; WhatsApp<\/p>\n<p>For loops can be used in templates that are enclosed in &#8220;%%,&#8221; and they can be called in a standard Python fashion. The variable (list) we read in the routing method is called the sites. The iterator may once more be used as a variable encased in quotation marks. This is similar to putting together a puzzle; to access a variable&#8217;s value, type &#8220;,&#8221; and to access any additional structures or blocks, type &#8220;%%.&#8221;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n    &lt;title&gt;FlaskTest&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h2&gt; Hello Everyone!!! &lt;\/h2&gt;\r\n    &lt;h4&gt;Flask: Rendering Templates&lt;\/h4&gt;\r\n    &lt;a href=\"{{ url_for('demo') }}\"&gt;Home&lt;\/a&gt;\r\n    &lt;a href=\"{{ url_for('test') }}\"&gt;About&lt;\/a&gt;\r\n    {% block body %}\r\n&lt;p&gt;Flask Application is successfully implemented.&lt;\/p&gt;\r\n    {% endblock %}\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Flask templates also support if-else statements. We can use it to generate dynamic templates in a manner reminiscent of the syntax for for loops. Let&#8217;s look at an illustration of a website position.<\/p>\n<p>Let&#8217;s construct the section contact&#8217;s path. This URL, &#8220;last\/func&gt;,&#8221; is linked to the function last, which outputs the &#8220;last.html&#8221; template. This acknowledges the role of the argument. Here, we can notice several alterations that are merely semantic in nature. There is nothing novel about using the field person as a separate identifier in the templates where role values were assigned.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">@app.route(\"\/last\/&lt;func&gt;\")\r\ndef last(func):\r\n    return render_template(\"last.html\", person=func)\r\n<\/pre>\n<p>As a result, the route is created as desired, and the variable role is parsed as a human to the design. Let&#8217;s start by making the template.<\/p>\n<p><strong>last.html<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">{% extends 'base.html' %}\r\n{% block content %}\r\n{% if user_type == \"admin\" %}\r\n&lt;p&gt; Welcome Admin &lt;\/p&gt;\r\n{% elif user_type == \"maintainer\" %}\r\n&lt;p&gt; Welcome Maintainer &lt;\/p&gt;\r\n{% elif user_type == \"member\" %}\r\n&lt;p&gt; Welcome Member &lt;\/p&gt;\r\n{% else %}\r\n&lt;p&gt; Hello, {{ person }}&lt;\/p&gt;\r\n{% endif %}\r\n{% endblock %}\r\n<\/pre>\n<p>The meaning of the variable person, which is retrieved from the URL and interpreted by the render template function, is therefore checked in the template. With merely &#8220;%%&#8221; enclosed, the the else syntax is comparable to that of Python. The code is rather self-explanatory because we build an if-elif and else ladders, check for a value, and then produce the necessary HTML elements.<\/p>\n<p>The output will depend on the value of the variable user_type passed to the template while rendering. For example, if user_type is &#8220;admin&#8221;, the output will be:<\/p>\n<p><strong>Welcome Admin<\/strong><\/p>\n<p>Similarly, if user_type is &#8220;maintainer&#8221;, the output will be:<\/p>\n<p><strong>Welcome Maintainer<\/strong><\/p>\n<h3>Conclusion<\/h3>\n<p>Therefore, it is clear that now the template in Flask is producing the information in accordance with the role variable that was supplied in the URL. Avoid attempting to construct a Hyperlink for this because we must manually insert the role variable, therefore it would not function. To use it, a workaround must be implemented.<br \/>\nThat covered how to use and render templates in Flask. To develop some dynamic templates, we used Python and the Jinja templating syntax.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will learn about template in flask Let&#8217;s start!! What are templates? Templates are scripts that include stand ins for data streams in addition to static data. To create the finished&#46;&#46;&#46;<\/p>\n","protected":false},"author":581,"featured_media":114774,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27373],"tags":[27625,27624],"class_list":["post-113243","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-flask-tutorials","tag-flask-template","tag-templates-in-flask"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Template in Flask - DataFlair<\/title>\n<meta name=\"description\" content=\"Templates are scripts that include stand ins for data streams in addition to static data. Learn Building and Developing Template in Flask.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/flask-templates\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Template in Flask - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Templates are scripts that include stand ins for data streams in addition to static data. Learn Building and Developing Template in Flask.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/flask-templates\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-22T13:37:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/flask-templates.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Template in Flask - DataFlair","description":"Templates are scripts that include stand ins for data streams in addition to static data. Learn Building and Developing Template in Flask.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/flask-templates\/","og_locale":"en_US","og_type":"article","og_title":"Template in Flask - DataFlair","og_description":"Templates are scripts that include stand ins for data streams in addition to static data. Learn Building and Developing Template in Flask.","og_url":"https:\/\/data-flair.training\/blogs\/flask-templates\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-07-22T13:37:38+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/flask-templates.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445"},"headline":"Template in Flask","datePublished":"2023-07-22T13:37:38+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/"},"wordCount":1545,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/flask-templates.webp","keywords":["flask template","Templates in Flask"],"articleSection":["Python Flask Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/flask-templates\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/","url":"https:\/\/data-flair.training\/blogs\/flask-templates\/","name":"Template in Flask - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/flask-templates.webp","datePublished":"2023-07-22T13:37:38+00:00","description":"Templates are scripts that include stand ins for data streams in addition to static data. Learn Building and Developing Template in Flask.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/flask-templates\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/flask-templates.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/flask-templates.webp","width":1200,"height":628,"caption":"flask templates"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/flask-templates\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Flask Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python-flask-tutorials\/"},{"@type":"ListItem","position":3,"name":"Template in Flask"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam6\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/113243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=113243"}],"version-history":[{"count":7,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/113243\/revisions"}],"predecessor-version":[{"id":116762,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/113243\/revisions\/116762"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/114774"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=113243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=113243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=113243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}