Minify HTML in Flask using Flask-Minify
Last Updated :
04 Jul, 2021
Flask offers HTML rendering as output, it is usually desired that the output HTML should be concise and it serves the purpose as well. In this article, we would display minification of output routes of Flask responses using the library - Flask-Minify.
Advantages of Minification
- Websites load faster as fewer lines are there to upload and download.
- Bandwidth cost is reduced as less data is flown over the network.
- Decompression is not needed before usage.
- As the site loads faster, UX and SEO improve as well.
Installation
To install this module type the below command in the terminal.
pip install Flask-Minify
Function Used: minify(self, app=None, html=True, js=True, cssless=True, fail_safe=True, bypass=[], passive=False, static=True, script_types=[])
Parameters:
- app: Flask app instance to be initiated.
- js: Minify js or not.
- cssless: Minify css or not.
- fail_safe: To avoid raising error while minifying.
- bypass: List of endpoints to bypass minifying.
- passive: to selectively minify routes
- static: To enable minifying static files css, less and js.
- script_types: List of script types to limit js minification to.
Stepwise Implementation
Step 1: Importing libraries and initializing Minify with app context.
Python3
from flask import Flask
from flask_minify import minify
app = Flask(__name__)
# initializing minify for html, js and cssless
minify(app=app, html=True, js=True, cssless=True)
Step 2: Adding route, output HTML with minified code.
Python3
@app.route('/')
def sample_minify():
return """<!doctype html>
<html lang=en-us prefix="og: http://ogp.me/ns#">
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1">
<meta name=description content="A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.">
<link rel="shortcut icon" href=https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_favicon.png type=image/x-icon>
<meta name=theme-color content="#308D46">
<meta property="og:image" content="https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_200x200-min.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<script defer src=https://apis.google.com/js/platform.js></script>
<script async src=//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js></script>
<script async src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<link rel=stylesheet href=https://use.typekit.net/mrg0hpc.css>
<title>GeeksforGeeks | A computer science portal for geeks</title>
<link rel=profile href=http://gmpg.org/xfn/11>
<link rel=pingback href>
<script type=application/ld+json>
<span>Python Tutorial</span>
<span class="gfg-icon gfg-icon_arrow-right"></span></a></ul></div></div></div></div><div class="side--container mb-30"><div class=card-layout><div class=heading><div class=def-title_wrap><div class=title>Featured Articles</div><a href=https://www.geeksforgeeks.org/featured-articles class=vall><span>View All</span>
<span class="gfg-icon gfg-icon_arrow-right_filled"></span></a></div></div><div class=rightbar--articles_container><div class=content-wrapper><ul class="content-wrapper content-wrapper_links"><li><a href="https://www.geeksforgeeks.org/must-do-coding-questions-for-product-based-companies/?ref=grb" title="Permalink to Must Do Coding Questions for Product Based Companies" rel=bookmark>Must Do Coding Questions for Product Based Companies</a>
<p>May 16, 2021<li><a href="https://www.geeksforgeeks.org/must-do-coding-questions-for-companies-like-amazon-microsoft-adobe/?ref=grb" title="Permalink to Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, …" rel=bookmark>Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, …</a>
<p>May 16, 2021<li><a href="https://www.geeksforgeeks.org/progeek-cup-2021-a-project-competition-by-geeksforgeeks/?ref=grb" title="Permalink to ProGeek Cup 2021 – A Project Competition By GeeksforGeeks" rel=bookmark>ProGeek Cup 2021 – A Project Competition By GeeksforGeeks</a>
<p>May 11, 2021<li><a href="https://www.geeksforgeeks.org/recently-asked-interview-questions-in-product-based-companies/?ref=grb" title="Permalink to Recently Asked Interview Questions in Product Based Companies" rel=bookmark>Recently Asked Interview Questions in Product Based Companies</a>
<p>May 11, 2021<li><a href="https://www.geeksforgeeks.org/bridge-the-gap-between-engineering-and-your-dream-job-complete-interview-preparation/?ref=grb" title="Permalink to Bridge the Gap Between Engineering and Your Dream Job – Complete Interview Preparation" rel=bookmark>Bridge the Gap Between Engineering and Your Dream Job – Complete Interview Preparation</a>
<p>May 1, 2021</ul></div></div></div></div><div class="side--container mb-30"><div id=secondary class=widget-area role=complementary><aside id=text-15 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-19 class="widget widget_text"><div class=textwidget><div class=heading><div class=def-title_wrap><div class=title>What’s New</div></div></div></div></aside><div class=card-layout><div class=content-wrapper><div class=side--container_wscard><a href="https://www.geeksforgeeks.org/courses/dsa-self-paced?utm_source=geeksforgeeks&utm_medium=article&utm_campaign=gfg_article_dsa_content_bottom"><div class=card-content><div class=thumbnail><img src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210203145720/DSA-SP_1-min.png class=img-fluid alt="DSA Self Paced Course"></div><div class=content><div class=head>DSA Self Paced Course</div><div class=ref>View Details</div></div></div></a></div></div></div><div class=card-layout><div class=content-wrapper><div class=side--container_wscard style=margin-top:-20px><a href="https://premium.geeksforgeeks.org/premium-plans/?utm_source=geeksforgeeks&utm_medium=article&utm_campaign=gfg_article_premium_content_bottom"><div class=card-content><div class=thumbnail><img src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210115220210/prethumb_min.png class=img-fluid alt="Ad free experience with GeeksforGeeks Premium"></div><div class=content><div class=head>Ad free experience with GeeksforGeeks Premium</div><div class=ref>View Details</div></div></div></a></div></div></div><aside id=text-16 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-17 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-18 class="widget widget_text"><div class=textwidget></div></aside></div></div><div class="side--container mb-30"><div class=card-layout><div class=heading><div class=def-title_wrap><div class=title>Recommended</div></div></div><div class=content-wrapper><div class=item-container><ul class="ql-list recommended"><li class=ql-list_item><a href="https://www.geeksforgeeks.org/category/guestblogs/?ref=grb" class=no-hover><span data-icon=one></span><span class="gfg-icon gfg-icon_arrow-right">Guest Blogs</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/must-coding-questions-company-wise/?ref=grb" class=no-hover><span data-icon=two></span><span class="gfg-icon gfg-icon_arrow-right">Must Do Coding Questions
Company-wise</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/practice-for-cracking-any-coding-interview/?ref=grb" class=no-hover><span data-icon=three></span><span class="gfg-icon gfg-icon_arrow-right">Practice for cracking any coding
interview</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/placements-gq/?ref=grb" class=no-hover><span data-icon=four></span><span class="gfg-icon gfg-icon_arrow-right">Placements</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/courses/cip-da/?ref=grb" class=no-hover><span data-icon=five></span><span class="gfg-icon gfg-icon_arrow-right">Complete Interview Preparation With
Doubt Assistance</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/gate-cs-notes-gq/?ref=grb" class=no-hover><span data-icon=six></span><span class="gfg-icon gfg-icon_arrow-right">GATE CS Notes according to GATE 2021
syllabus</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/machine-learning/?ref=grb" class=no-hover><span data-icon=seven></span><span class="gfg-icon gfg-icon_arrow-right">Machine Learning</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/django-tutorial/?ref=grb" class=no-hover><span data-icon=eight></span><span class="gfg-icon gfg-icon_arrow-right">Django Tutorial</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/computer-science-projects/?ref=grb" class=no-hover><span data-icon=nine></span><span class="gfg-icon gfg-icon_arrow-right">Computer Science Projects</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/courses/Amazon-Test-Series/?ref=grb" class=no-hover><span data-icon=ten></span><span class="gfg-icon gfg-icon_arrow-right">Amazon SDE Test Series</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/company-interview-corner/?ref=grb" class=no-hover><span data-icon=eleven></span><span class="gfg-icon gfg-icon_arrow-right">Company Interview Corner</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/the-c-standard-template-library-stl/?ref=grb" class=no-hover><span data-icon=twelve></span><span class="gfg-icon gfg-icon_arrow-right">The C++ Standard Template Library
(STL)</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/software-design-patterns/?ref=grb" class=no-hover><span data-icon=thirteen></span><span class="gfg-icon gfg-icon_arrow-right">Software Design Patterns</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/sql-tutorial/?ref=grb" class=no-hover><span data-icon=fourteen></span><span class="gfg-icon gfg-icon_arrow-right">SQL Tutorial</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/advanced-data-structures/?ref=grb" class=no-hover><span data-icon=fifteen></span><span class="gfg-icon gfg-icon_arrow-right">Advanced Data Structures</span></a></ul></div></div></div></div></div></div></div></div><footer class=gfg-footer id=gfg-footer><div class=footer-wrapper><div class=footer-wrapper_branding><a class=footer-wrapper_branding-anchor href=https://www.geeksforgeeks.org/><img class=footer-wrapper_branding-nlogo src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/logo-new-2.svg alt=GeeksforGeeks></a><div class=footer-wrapper_branding-address><i class="gfg-icon gfg-icon_pin"></i>
<span>5th Floor, A-118,<br>Sector-136, Noida, Uttar Pradesh - 201305</span></div><div class=footer-wrapper_branding-email><i class="gfg-icon gfg-icon_mail"></i>
<a href=mailto:[email protected]>[email protected]</a></div><div class=footer-wrapper_branding-social><a href=https://www.facebook.com/geeksforgeeks.org/ rel="noopener noreferrer" aria-label="GeeksforGeeks Facebook" target=_blank><div class=facebook></div></a><a href=https://www.instagram.com/geeks_for_geeks/ rel="noopener noreferrer" aria-label="GeeksforGeeks Instagram" target=_blank><div class=instagram></div></a><a href=https://in.linkedin.com/company/geeksforgeeks rel="noopener noreferrer" aria-label="GeeksforGeeks LinkedIn" target=_blank><div class=linkedin></div></a><a href=https://twitter.com/geeksforgeeks rel="noopener noreferrer" aria-label="GeeksforGeeks Twitter" target=_blank><div class=twitter></div></a><a href=https://www.youtube.com/geeksforgeeksvideos rel="noopener noreferrer" aria-label="GeeksforGeeks YouTube" target=_blank><div class=youtube></div></a></div></div><div class=footer-wrapper_links><ul class=footer-wrapper_links-list><li>Company<li><a href=https://www.geeksforgeeks.org/about/>About Us</a><li><a href=https://www.geeksforgeeks.org/careers/>Careers</a><li><a href=https://www.geeksforgeeks.org/privacy-policy/>Privacy Policy</a><li><a href=https://www.geeksforgeeks.org/about/contact-us/>Contact Us</a><li><a href=https://www.geeksforgeeks.org/copyright-information/>Copyright Policy</a></ul><ul class=footer-wrapper_links-list><li>Learn<li><a href=https://www.geeksforgeeks.org/fundamentals-of-algorithms/>Algorithms</a><li><a href=https://www.geeksforgeeks.org/data-structures/>Data Structures</a><li><a href=https://www.geeksforgeeks.org/category/program-output/>Languages</a><li><a href=https://www.geeksforgeeks.org/articles-on-computer-science-subjects-gq/>CS
Subjects</a><li><a href=https://www.youtube.com/geeksforgeeksvideos/>Video Tutorials</a></ul><ul class=footer-wrapper_links-list><li>Practice<li><a href=https://www.geeksforgeeks.org/courses/>Courses</a><li><a href=https://practice.geeksforgeeks.org/company-tags/>Company-wise</a><li><a href=https://practice.geeksforgeeks.org/topic-tags/>Topic-wise</a><li><a href=https://practice.geeksforgeeks.org/faq.php>How to begin?</a></ul><ul class=footer-wrapper_links-list><li>Contribute<li><a href=https://www.geeksforgeeks.org/contribute/>Write an Article</a><li><a href=https://www.geeksforgeeks.org/write-interview-experience/>Write Interview
Experience</a><li><a href="https://www.geeksforgeeks.org/careers/?job_type=1">Internships</a><li><a href=https://www.geeksforgeeks.org/how-to-contribute-videos-to-geeksforgeeks/>Videos</a></ul></div></div><div class=footer-strip><div class=copyright><a href=https://www.geeksforgeeks.org/ rel="noopener noreferrer" target=_blank>@geeksforgeeks</a>
<span>, <a href=https://www.geeksforgeeks.org/copyright-information/>Some rights reserved</a></span></div><div class=social-links></div></div></footer></div><script src="https://www.geeksforgeeks.org/wp-includes/js/wp-embed.min.js?ver=4.9.8">
</script>
<script>
jQuery(document).ready(function($) { RESPONSIVEUI.responsiveTabs(); })
</script>
<div class="cookie-consent hide-consent"><span class=cookie-text>We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
<a href=https://www.geeksforgeeks.org/cookie-policy/ target=_blank><u>Cookie Policy</u></a> &
<a href=https://www.geeksforgeeks.org/privacy-policy/ target=_blank><u>Privacy Policy</u></a></span>
<button class=consent-btn>Got It !</button>
</div>
<div class=lightbox-target>
<img id=lightbox-image src alt=Lightbox>
<span class=lightbox-close></span>
</div>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12148232-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>"""
Step 3 : Running application
Python3
if __name__ == "__main__":
app.run()
Output :
Example 2: Applying minification to some routes
In this, we can perform minification on only required routes not all, as per requirements. This is done by passing "passive=True" while passing context.
Python3
from flask import Flask
from flask_minify import minify, decorators
app = Flask(__name__)
# passive = True, just performs minification to required routes
minify(app=app, passive=True)
# minifies this route
@app.route('/')
@decorators.minify(html=True, js=True, cssless=True)
def sample_minify():
return """<!doctype html>
<html lang=en-us prefix="og: http://ogp.me/ns#">
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1">
<meta name=description content="A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.">
<link rel="shortcut icon" href=https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_favicon.png type=image/x-icon>
<meta name=theme-color content="#308D46">
<meta property="og:image" content="https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_200x200-min.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<script defer src=https://apis.google.com/js/platform.js></script>
<script async src=//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js></script>
<script async src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<link rel=stylesheet href=https://use.typekit.net/mrg0hpc.css>
<title>GeeksforGeeks | A computer science portal for geeks</title>
<link rel=profile href=http://gmpg.org/xfn/11>
<link rel=pingback href>
<script type=application/ld+json>
<span>Python Tutorial</span>
<span class="gfg-icon gfg-icon_arrow-right"></span></a></ul></div></div></div></div><div class="side--container mb-30"><div class=card-layout><div class=heading><div class=def-title_wrap><div class=title>Featured Articles</div><a href=https://www.geeksforgeeks.org/featured-articles class=vall><span>View All</span>
<span class="gfg-icon gfg-icon_arrow-right_filled"></span></a></div></div><div class=rightbar--articles_container><div class=content-wrapper><ul class="content-wrapper content-wrapper_links"><li><a href="https://www.geeksforgeeks.org/must-do-coding-questions-for-product-based-companies/?ref=grb" title="Permalink to Must Do Coding Questions for Product Based Companies" rel=bookmark>Must Do Coding Questions for Product Based Companies</a>
<p>May 16, 2021<li><a href="https://www.geeksforgeeks.org/must-do-coding-questions-for-companies-like-amazon-microsoft-adobe/?ref=grb" title="Permalink to Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, …" rel=bookmark>Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, …</a>
<p>May 16, 2021<li><a href="https://www.geeksforgeeks.org/progeek-cup-2021-a-project-competition-by-geeksforgeeks/?ref=grb" title="Permalink to ProGeek Cup 2021 – A Project Competition By GeeksforGeeks" rel=bookmark>ProGeek Cup 2021 – A Project Competition By GeeksforGeeks</a>
<p>May 11, 2021<li><a href="https://www.geeksforgeeks.org/recently-asked-interview-questions-in-product-based-companies/?ref=grb" title="Permalink to Recently Asked Interview Questions in Product Based Companies" rel=bookmark>Recently Asked Interview Questions in Product Based Companies</a>
<p>May 11, 2021<li><a href="https://www.geeksforgeeks.org/bridge-the-gap-between-engineering-and-your-dream-job-complete-interview-preparation/?ref=grb" title="Permalink to Bridge the Gap Between Engineering and Your Dream Job – Complete Interview Preparation" rel=bookmark>Bridge the Gap Between Engineering and Your Dream Job – Complete Interview Preparation</a>
<p>May 1, 2021</ul></div></div></div></div><div class="side--container mb-30"><div id=secondary class=widget-area role=complementary><aside id=text-15 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-19 class="widget widget_text"><div class=textwidget><div class=heading><div class=def-title_wrap><div class=title>What’s New</div></div></div></div></aside><div class=card-layout><div class=content-wrapper><div class=side--container_wscard><a href="https://www.geeksforgeeks.org/courses/dsa-self-paced?utm_source=geeksforgeeks&utm_medium=article&utm_campaign=gfg_article_dsa_content_bottom"><div class=card-content><div class=thumbnail><img src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210203145720/DSA-SP_1-min.png class=img-fluid alt="DSA Self Paced Course"></div><div class=content><div class=head>DSA Self Paced Course</div><div class=ref>View Details</div></div></div></a></div></div></div><div class=card-layout><div class=content-wrapper><div class=side--container_wscard style=margin-top:-20px><a href="https://premium.geeksforgeeks.org/premium-plans/?utm_source=geeksforgeeks&utm_medium=article&utm_campaign=gfg_article_premium_content_bottom"><div class=card-content><div class=thumbnail><img src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210115220210/prethumb_min.png class=img-fluid alt="Ad free experience with GeeksforGeeks Premium"></div><div class=content><div class=head>Ad free experience with GeeksforGeeks Premium</div><div class=ref>View Details</div></div></div></a></div></div></div><aside id=text-16 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-17 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-18 class="widget widget_text"><div class=textwidget></div></aside></div></div><div class="side--container mb-30"><div class=card-layout><div class=heading><div class=def-title_wrap><div class=title>Recommended</div></div></div><div class=content-wrapper><div class=item-container><ul class="ql-list recommended"><li class=ql-list_item><a href="https://www.geeksforgeeks.org/category/guestblogs/?ref=grb" class=no-hover><span data-icon=one></span><span class="gfg-icon gfg-icon_arrow-right">Guest Blogs</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/must-coding-questions-company-wise/?ref=grb" class=no-hover><span data-icon=two></span><span class="gfg-icon gfg-icon_arrow-right">Must Do Coding Questions
Company-wise</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/practice-for-cracking-any-coding-interview/?ref=grb" class=no-hover><span data-icon=three></span><span class="gfg-icon gfg-icon_arrow-right">Practice for cracking any coding
interview</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/placements-gq/?ref=grb" class=no-hover><span data-icon=four></span><span class="gfg-icon gfg-icon_arrow-right">Placements</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/courses/cip-da/?ref=grb" class=no-hover><span data-icon=five></span><span class="gfg-icon gfg-icon_arrow-right">Complete Interview Preparation With
Doubt Assistance</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/gate-cs-notes-gq/?ref=grb" class=no-hover><span data-icon=six></span><span class="gfg-icon gfg-icon_arrow-right">GATE CS Notes according to GATE 2021
syllabus</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/machine-learning/?ref=grb" class=no-hover><span data-icon=seven></span><span class="gfg-icon gfg-icon_arrow-right">Machine Learning</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/django-tutorial/?ref=grb" class=no-hover><span data-icon=eight></span><span class="gfg-icon gfg-icon_arrow-right">Django Tutorial</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/computer-science-projects/?ref=grb" class=no-hover><span data-icon=nine></span><span class="gfg-icon gfg-icon_arrow-right">Computer Science Projects</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/courses/Amazon-Test-Series/?ref=grb" class=no-hover><span data-icon=ten></span><span class="gfg-icon gfg-icon_arrow-right">Amazon SDE Test Series</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/company-interview-corner/?ref=grb" class=no-hover><span data-icon=eleven></span><span class="gfg-icon gfg-icon_arrow-right">Company Interview Corner</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/the-c-standard-template-library-stl/?ref=grb" class=no-hover><span data-icon=twelve></span><span class="gfg-icon gfg-icon_arrow-right">The C++ Standard Template Library
(STL)</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/software-design-patterns/?ref=grb" class=no-hover><span data-icon=thirteen></span><span class="gfg-icon gfg-icon_arrow-right">Software Design Patterns</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/sql-tutorial/?ref=grb" class=no-hover><span data-icon=fourteen></span><span class="gfg-icon gfg-icon_arrow-right">SQL Tutorial</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/advanced-data-structures/?ref=grb" class=no-hover><span data-icon=fifteen></span><span class="gfg-icon gfg-icon_arrow-right">Advanced Data Structures</span></a></ul></div></div></div></div></div></div></div></div><footer class=gfg-footer id=gfg-footer><div class=footer-wrapper><div class=footer-wrapper_branding><a class=footer-wrapper_branding-anchor href=https://www.geeksforgeeks.org/><img class=footer-wrapper_branding-nlogo src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/logo-new-2.svg alt=GeeksforGeeks></a><div class=footer-wrapper_branding-address><i class="gfg-icon gfg-icon_pin"></i>
<span>5th Floor, A-118,<br>Sector-136, Noida, Uttar Pradesh - 201305</span></div><div class=footer-wrapper_branding-email><i class="gfg-icon gfg-icon_mail"></i>
<a href=mailto:[email protected]>[email protected]</a></div><div class=footer-wrapper_branding-social><a href=https://www.facebook.com/geeksforgeeks.org/ rel="noopener noreferrer" aria-label="GeeksforGeeks Facebook" target=_blank><div class=facebook></div></a><a href=https://www.instagram.com/geeks_for_geeks/ rel="noopener noreferrer" aria-label="GeeksforGeeks Instagram" target=_blank><div class=instagram></div></a><a href=https://in.linkedin.com/company/geeksforgeeks rel="noopener noreferrer" aria-label="GeeksforGeeks LinkedIn" target=_blank><div class=linkedin></div></a><a href=https://twitter.com/geeksforgeeks rel="noopener noreferrer" aria-label="GeeksforGeeks Twitter" target=_blank><div class=twitter></div></a><a href=https://www.youtube.com/geeksforgeeksvideos rel="noopener noreferrer" aria-label="GeeksforGeeks YouTube" target=_blank><div class=youtube></div></a></div></div><div class=footer-wrapper_links><ul class=footer-wrapper_links-list><li>Company<li><a href=https://www.geeksforgeeks.org/about/>About Us</a><li><a href=https://www.geeksforgeeks.org/careers/>Careers</a><li><a href=https://www.geeksforgeeks.org/privacy-policy/>Privacy Policy</a><li><a href=https://www.geeksforgeeks.org/about/contact-us/>Contact Us</a><li><a href=https://www.geeksforgeeks.org/copyright-information/>Copyright Policy</a></ul><ul class=footer-wrapper_links-list><li>Learn<li><a href=https://www.geeksforgeeks.org/fundamentals-of-algorithms/>Algorithms</a><li><a href=https://www.geeksforgeeks.org/data-structures/>Data Structures</a><li><a href=https://www.geeksforgeeks.org/category/program-output/>Languages</a><li><a href=https://www.geeksforgeeks.org/articles-on-computer-science-subjects-gq/>CS
Subjects</a><li><a href=https://www.youtube.com/geeksforgeeksvideos/>Video Tutorials</a></ul><ul class=footer-wrapper_links-list><li>Practice<li><a href=https://www.geeksforgeeks.org/courses/>Courses</a><li><a href=https://practice.geeksforgeeks.org/company-tags/>Company-wise</a><li><a href=https://practice.geeksforgeeks.org/topic-tags/>Topic-wise</a><li><a href=https://practice.geeksforgeeks.org/faq.php>How to begin?</a></ul><ul class=footer-wrapper_links-list><li>Contribute<li><a href=https://www.geeksforgeeks.org/contribute/>Write an Article</a><li><a href=https://www.geeksforgeeks.org/write-interview-experience/>Write Interview
Experience</a><li><a href="https://www.geeksforgeeks.org/careers/?job_type=1">Internships</a><li><a href=https://www.geeksforgeeks.org/how-to-contribute-videos-to-geeksforgeeks/>Videos</a></ul></div></div><div class=footer-strip><div class=copyright><a href=https://www.geeksforgeeks.org/ rel="noopener noreferrer" target=_blank>@geeksforgeeks</a>
<span>, <a href=https://www.geeksforgeeks.org/copyright-information/>Some rights reserved</a></span></div><div class=social-links></div></div></footer></div><script src="https://www.geeksforgeeks.org/wp-includes/js/wp-embed.min.js?ver=4.9.8">
</script>
<script>
jQuery(document).ready(function($) { RESPONSIVEUI.responsiveTabs(); })
</script>
<div class="cookie-consent hide-consent"><span class=cookie-text>We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
<a href=https://www.geeksforgeeks.org/cookie-policy/ target=_blank><u>Cookie Policy</u></a> &
<a href=https://www.geeksforgeeks.org/privacy-policy/ target=_blank><u>Privacy Policy</u></a></span>
<button class=consent-btn>Got It !</button>
</div>
<div class=lightbox-target>
<img id=lightbox-image src alt=Lightbox>
<span class=lightbox-close></span>
</div>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12148232-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>"""
# doesn't minify this route
@app.route('/no_mini')
def no_minify():
return """<!doctype html>
<html lang=en-us prefix="og: http://ogp.me/ns#">
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1">
<meta name=description content="A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.">
<link rel="shortcut icon" href=https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_favicon.png type=image/x-icon>
<meta name=theme-color content="#308D46">
<meta property="og:image" content="https://media.geeksforgeeks.org/wp-content/cdn-uploads/gfg_200x200-min.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="200">
<meta property="og:image:height" content="200">
<script defer src=https://apis.google.com/js/platform.js></script>
<script async src=//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js></script>
<script async src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<link rel=stylesheet href=https://use.typekit.net/mrg0hpc.css>
<title>GeeksforGeeks | A computer science portal for geeks</title>
<link rel=profile href=http://gmpg.org/xfn/11>
<link rel=pingback href>
<script type=application/ld+json>
<span>Python Tutorial</span>
<span class="gfg-icon gfg-icon_arrow-right"></span></a></ul></div></div></div></div><div class="side--container mb-30"><div class=card-layout><div class=heading><div class=def-title_wrap><div class=title>Featured Articles</div><a href=https://www.geeksforgeeks.org/featured-articles class=vall><span>View All</span>
<span class="gfg-icon gfg-icon_arrow-right_filled"></span></a></div></div><div class=rightbar--articles_container><div class=content-wrapper><ul class="content-wrapper content-wrapper_links"><li><a href="https://www.geeksforgeeks.org/must-do-coding-questions-for-product-based-companies/?ref=grb" title="Permalink to Must Do Coding Questions for Product Based Companies" rel=bookmark>Must Do Coding Questions for Product Based Companies</a>
<p>May 16, 2021<li><a href="https://www.geeksforgeeks.org/must-do-coding-questions-for-companies-like-amazon-microsoft-adobe/?ref=grb" title="Permalink to Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, …" rel=bookmark>Must Do Coding Questions for Companies like Amazon, Microsoft, Adobe, …</a>
<p>May 16, 2021<li><a href="https://www.geeksforgeeks.org/progeek-cup-2021-a-project-competition-by-geeksforgeeks/?ref=grb" title="Permalink to ProGeek Cup 2021 – A Project Competition By GeeksforGeeks" rel=bookmark>ProGeek Cup 2021 – A Project Competition By GeeksforGeeks</a>
<p>May 11, 2021<li><a href="https://www.geeksforgeeks.org/recently-asked-interview-questions-in-product-based-companies/?ref=grb" title="Permalink to Recently Asked Interview Questions in Product Based Companies" rel=bookmark>Recently Asked Interview Questions in Product Based Companies</a>
<p>May 11, 2021<li><a href="https://www.geeksforgeeks.org/bridge-the-gap-between-engineering-and-your-dream-job-complete-interview-preparation/?ref=grb" title="Permalink to Bridge the Gap Between Engineering and Your Dream Job – Complete Interview Preparation" rel=bookmark>Bridge the Gap Between Engineering and Your Dream Job – Complete Interview Preparation</a>
<p>May 1, 2021</ul></div></div></div></div><div class="side--container mb-30"><div id=secondary class=widget-area role=complementary><aside id=text-15 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-19 class="widget widget_text"><div class=textwidget><div class=heading><div class=def-title_wrap><div class=title>What’s New</div></div></div></div></aside><div class=card-layout><div class=content-wrapper><div class=side--container_wscard><a href="https://www.geeksforgeeks.org/courses/dsa-self-paced?utm_source=geeksforgeeks&utm_medium=article&utm_campaign=gfg_article_dsa_content_bottom"><div class=card-content><div class=thumbnail><img src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210203145720/DSA-SP_1-min.png class=img-fluid alt="DSA Self Paced Course"></div><div class=content><div class=head>DSA Self Paced Course</div><div class=ref>View Details</div></div></div></a></div></div></div><div class=card-layout><div class=content-wrapper><div class=side--container_wscard style=margin-top:-20px><a href="https://premium.geeksforgeeks.org/premium-plans/?utm_source=geeksforgeeks&utm_medium=article&utm_campaign=gfg_article_premium_content_bottom"><div class=card-content><div class=thumbnail><img src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/20210115220210/prethumb_min.png class=img-fluid alt="Ad free experience with GeeksforGeeks Premium"></div><div class=content><div class=head>Ad free experience with GeeksforGeeks Premium</div><div class=ref>View Details</div></div></div></a></div></div></div><aside id=text-16 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-17 class="widget widget_text"><div class=textwidget></div></aside><aside id=text-18 class="widget widget_text"><div class=textwidget></div></aside></div></div><div class="side--container mb-30"><div class=card-layout><div class=heading><div class=def-title_wrap><div class=title>Recommended</div></div></div><div class=content-wrapper><div class=item-container><ul class="ql-list recommended"><li class=ql-list_item><a href="https://www.geeksforgeeks.org/category/guestblogs/?ref=grb" class=no-hover><span data-icon=one></span><span class="gfg-icon gfg-icon_arrow-right">Guest Blogs</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/must-coding-questions-company-wise/?ref=grb" class=no-hover><span data-icon=two></span><span class="gfg-icon gfg-icon_arrow-right">Must Do Coding Questions
Company-wise</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/practice-for-cracking-any-coding-interview/?ref=grb" class=no-hover><span data-icon=three></span><span class="gfg-icon gfg-icon_arrow-right">Practice for cracking any coding
interview</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/placements-gq/?ref=grb" class=no-hover><span data-icon=four></span><span class="gfg-icon gfg-icon_arrow-right">Placements</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/courses/cip-da/?ref=grb" class=no-hover><span data-icon=five></span><span class="gfg-icon gfg-icon_arrow-right">Complete Interview Preparation With
Doubt Assistance</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/gate-cs-notes-gq/?ref=grb" class=no-hover><span data-icon=six></span><span class="gfg-icon gfg-icon_arrow-right">GATE CS Notes according to GATE 2021
syllabus</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/machine-learning/?ref=grb" class=no-hover><span data-icon=seven></span><span class="gfg-icon gfg-icon_arrow-right">Machine Learning</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/django-tutorial/?ref=grb" class=no-hover><span data-icon=eight></span><span class="gfg-icon gfg-icon_arrow-right">Django Tutorial</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/computer-science-projects/?ref=grb" class=no-hover><span data-icon=nine></span><span class="gfg-icon gfg-icon_arrow-right">Computer Science Projects</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/courses/Amazon-Test-Series/?ref=grb" class=no-hover><span data-icon=ten></span><span class="gfg-icon gfg-icon_arrow-right">Amazon SDE Test Series</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/company-interview-corner/?ref=grb" class=no-hover><span data-icon=eleven></span><span class="gfg-icon gfg-icon_arrow-right">Company Interview Corner</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/the-c-standard-template-library-stl/?ref=grb" class=no-hover><span data-icon=twelve></span><span class="gfg-icon gfg-icon_arrow-right">The C++ Standard Template Library
(STL)</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/software-design-patterns/?ref=grb" class=no-hover><span data-icon=thirteen></span><span class="gfg-icon gfg-icon_arrow-right">Software Design Patterns</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/sql-tutorial/?ref=grb" class=no-hover><span data-icon=fourteen></span><span class="gfg-icon gfg-icon_arrow-right">SQL Tutorial</span></a><li class=ql-list_item><a href="https://www.geeksforgeeks.org/advanced-data-structures/?ref=grb" class=no-hover><span data-icon=fifteen></span><span class="gfg-icon gfg-icon_arrow-right">Advanced Data Structures</span></a></ul></div></div></div></div></div></div></div></div><footer class=gfg-footer id=gfg-footer><div class=footer-wrapper><div class=footer-wrapper_branding><a class=footer-wrapper_branding-anchor href=https://www.geeksforgeeks.org/><img class=footer-wrapper_branding-nlogo src=https://media.geeksforgeeks.org/wp-content/cdn-uploads/logo-new-2.svg alt=GeeksforGeeks></a><div class=footer-wrapper_branding-address><i class="gfg-icon gfg-icon_pin"></i>
<span>5th Floor, A-118,<br>Sector-136, Noida, Uttar Pradesh - 201305</span></div><div class=footer-wrapper_branding-email><i class="gfg-icon gfg-icon_mail"></i>
<a href=mailto:[email protected]>[email protected]</a></div><div class=footer-wrapper_branding-social><a href=https://www.facebook.com/geeksforgeeks.org/ rel="noopener noreferrer" aria-label="GeeksforGeeks Facebook" target=_blank><div class=facebook></div></a><a href=https://www.instagram.com/geeks_for_geeks/ rel="noopener noreferrer" aria-label="GeeksforGeeks Instagram" target=_blank><div class=instagram></div></a><a href=https://in.linkedin.com/company/geeksforgeeks rel="noopener noreferrer" aria-label="GeeksforGeeks LinkedIn" target=_blank><div class=linkedin></div></a><a href=https://twitter.com/geeksforgeeks rel="noopener noreferrer" aria-label="GeeksforGeeks Twitter" target=_blank><div class=twitter></div></a><a href=https://www.youtube.com/geeksforgeeksvideos rel="noopener noreferrer" aria-label="GeeksforGeeks YouTube" target=_blank><div class=youtube></div></a></div></div><div class=footer-wrapper_links><ul class=footer-wrapper_links-list><li>Company<li><a href=https://www.geeksforgeeks.org/about/>About Us</a><li><a href=https://www.geeksforgeeks.org/careers/>Careers</a><li><a href=https://www.geeksforgeeks.org/privacy-policy/>Privacy Policy</a><li><a href=https://www.geeksforgeeks.org/about/contact-us/>Contact Us</a><li><a href=https://www.geeksforgeeks.org/copyright-information/>Copyright Policy</a></ul><ul class=footer-wrapper_links-list><li>Learn<li><a href=https://www.geeksforgeeks.org/fundamentals-of-algorithms/>Algorithms</a><li><a href=https://www.geeksforgeeks.org/data-structures/>Data Structures</a><li><a href=https://www.geeksforgeeks.org/category/program-output/>Languages</a><li><a href=https://www.geeksforgeeks.org/articles-on-computer-science-subjects-gq/>CS
Subjects</a><li><a href=https://www.youtube.com/geeksforgeeksvideos/>Video Tutorials</a></ul><ul class=footer-wrapper_links-list><li>Practice<li><a href=https://www.geeksforgeeks.org/courses/>Courses</a><li><a href=https://practice.geeksforgeeks.org/company-tags/>Company-wise</a><li><a href=https://practice.geeksforgeeks.org/topic-tags/>Topic-wise</a><li><a href=https://practice.geeksforgeeks.org/faq.php>How to begin?</a></ul><ul class=footer-wrapper_links-list><li>Contribute<li><a href=https://www.geeksforgeeks.org/contribute/>Write an Article</a><li><a href=https://www.geeksforgeeks.org/write-interview-experience/>Write Interview
Experience</a><li><a href="https://www.geeksforgeeks.org/careers/?job_type=1">Internships</a><li><a href=https://www.geeksforgeeks.org/how-to-contribute-videos-to-geeksforgeeks/>Videos</a></ul></div></div><div class=footer-strip><div class=copyright><a href=https://www.geeksforgeeks.org/ rel="noopener noreferrer" target=_blank>@geeksforgeeks</a>
<span>, <a href=https://www.geeksforgeeks.org/copyright-information/>Some rights reserved</a></span></div><div class=social-links></div></div></footer></div><script src="https://www.geeksforgeeks.org/wp-includes/js/wp-embed.min.js?ver=4.9.8">
</script>
<script>
jQuery(document).ready(function($) { RESPONSIVEUI.responsiveTabs(); })
</script>
<div class="cookie-consent hide-consent"><span class=cookie-text>We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
<a href=https://www.geeksforgeeks.org/cookie-policy/ target=_blank><u>Cookie Policy</u></a> &
<a href=https://www.geeksforgeeks.org/privacy-policy/ target=_blank><u>Privacy Policy</u></a></span>
<button class=consent-btn>Got It !</button>
</div>
<div class=lightbox-target>
<img id=lightbox-image src alt=Lightbox>
<span class=lightbox-close></span>
</div>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12148232-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>"""
if __name__ == "__main__":
app.run()
Output :

Similar Reads
How to use Flask-Session in Python Flask
Sessions in Flask store user-specific data across requests, like login status, using cookies. Data is stored on the client side but signed with a secret key to ensure security. They help maintain user sessions without requiring constant authentication.This article demonstrates how to implement serve
4 min read
Retrieving HTML Form data using Flask
Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications. It began as a simple wrapper around Werkzeug and Jinja and has become one of the most popular Python web application frameworks. Read th
3 min read
Single Page Portfolio using Flask
In this article, weâll discuss how to create a single-page portfolio webpage using the Flask framework. This project demonstrates how to build an impressive portfolio to showcase your skills and experience to HR professionals, colleagues, or potential employers.Key features of this portfolio are-Dow
7 min read
Python | Using for loop in Flask
Prerequisite: HTML Basics, Python Basics, Flask It is not possible to write front-end course every time user make changes in his/her profile. We use a template and it generates code according to the content. Flask is one of the web development frameworks written in Python. Through flask, a loop can
3 min read
Todo list app using Flask | Python
There are many frameworks that allow building your webpage using Python, like Django, flask, etc. Flask is a web application framework written in Python. Flask is based on WSGI(Web Server Gateway Interface) toolkit and Jinja2 template engine. Its modules and libraries that help the developer to writ
3 min read
Integrating HAL in Flask
Hypertext Application Language (HAL) is a standard that is used to establish conventions for expressing hypermedia controls, such as links, with JSON. It is considered as a generic media type through which web API can be developed and exposed as a series of links. In this article, we will be using
2 min read
Create HTML User Interface using Eel in Python
Eel is a Python library for making simple offline HTML/JS GUI apps, with full access to Python capabilities and libraries. Eel hosts a local webserver, then lets you annotate functions in Python so that they can be called from JavaScript, and vice versa.InstallationTo install this module, type the b
2 min read
How to Use CSS in Python Flask
Flask is a popular web framework for Python that makes it easy to build web applications. One of the key elements of any web application is styling, which is where CSS (Cascading Style Sheets) comes in. CSS allows us to control the look and feel of our web pages, making them more attractive and user
3 min read
Generate HTML using tinyhtml module in Python
Creating HTML can sometimes be tedious tasks and difficult to debug and error-prone. A way to solve this is using some library which can take care of the opening and closing div, etc, which can reduce chances for mistakes. We will use the tinyhtml module for this purpose. This module provides a set
3 min read
How to make HTML files open in Chrome using Python?
Prerequisites: Webbrowser HTML files contain Hypertext Markup Language (HTML), which is used to design and format the structure of a webpage. It is stored in a text format and contains tags that define the layout and content of the webpage. HTML files are widely used online and displayed in web brow
2 min read