Python Flask Web Development: Overview of Flask & How to Install Flask

flask-python

Introduction to Python Flask Web Development: Overview of Flask & How to Install Flask

In the following series, we will be covering how you can start building web applications with Python, using the Flask framework. We will be going in-depth into the Flask web development framework, and going over a wide-range of topics that show you the power of Flask.

What is Flask?

Flask is a powerful, small web framework for Python. It is considered a “micro-framwork”, and is designed to be extensible. Flask is built off of Werkzeug and uses Jinja2 as its templating engine to render HTML pages. Werkzeug handles all the routing, debugging, and Web Server Gateway Interface (WSGI) subsystems for Flask, while Jinja2 handles all the template support for Flask. I’ll also be going more into depth with templates in the later tutorials regarding Flask, so don’t worry if you don’t understand what templates are, and how Jinja2 comes into play.

Why learn Flask (especially as your first python web framework)?

Compared to other web frameworks such as Django, Flask doesn’t come with a lot of pre-built functionality such as user-authentication, or databases. Even though Flask supports all databases, it doesn’t specifically come with one. This is can be very good because it lets the developer decide what they want to specifically use in their application, and gives the developer more control. Flask gives developers freedom, which is why it is a great framework to learn. Flask is also a great framework for beginners that are new to web development in python, because Flask is a very simple framework to learn. Flask comes with a strong core that provides you with all the basic functionality you’d need, and then the rest is on you to decide how you want to extend the framework, as in which database you’d want to use, etc.

How does Flask compare to other frameworks (Flask vs. Django)?

Often I see many people asking which framework they should use (mostly beginners), whether they should use Flask or Django, obviously it really depends on context. If you’re a developer who wants more control over your application, and less bloat, Flask is great because it’s very minimal as opposed to Django which comes with a lot of functionality included. Now if you’re a complete beginner to web development in Python, then Flask again would be a great framework to start with due to its simplicity. It also depends on what you’re trying to build, with Flask it’s usually a good idea to stick to smaller applications, as opposed to building something like a Facebook, Twitter, or Instagram sized application. However note that Pinterest and Twillo both use Flask, with Pinterest using Flask for their API, so really it doesn’t truly matter what your project size is, however it tends to always be easier to build larger applications with a framework that comes built in with a lot of functionality so you (and your team) can focus on the higher level parts of your application. The bottom line is, web frameworks such as Ruby on Rails and Django have a more “convention over configuration” approach (which has it is benefits), as opposed to Flask which makes you decide every package you want to use in your application.

How to install PIP (Python’s Package Manager)

To install Flask, you will first need to see if you have PIP installed. If you don’t know what PIP is, PIP is a package manager for Python that helps you manage the installation of python modules that are hosted on the Python Package Index (PyPI). Flask is one of those modules, and the reason we use PIP is because it’s extremely easy to use PIP to install Python module right from the source, and allows you also to update your modules right from the command line.

How to install Flask

To install Flask onto your computer:

Additional Links 

 

Leave a Reply

Follow Us 🐦

Shares