Tuesday, September 25, 2018
Home > Blog > Python and Flask Tutorials Building Websites from Scratch

Python and Flask Tutorials Building Websites from Scratch

, Python and Flask Tutorials Building Websites from Scratch

—————————————————————————————————–
Python and Django Tutorials Building Websites from Scratch
HD version: https://www.youtube.com/watch?v=5809nv1SC0o
——————————————————————————————————

Flask is a micro web framework written in Python and based on the Werkzeug toolkit and Jinja2 template engine. It is BSD licensed.

The latest stable version of Flask is 0.11.1. Applications that use the Flask framework include Pinterest, LinkedIn, and the community web page for Flask itself.

Flask is called a micro framework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools. Extensions are updated far more regularly than the core Flask program.

Flask is considered more Pythonic than Django because Flask web application code is in most cases more explicit. Flask is easy to get started with as a beginner because there is little boilerplate code for getting a simple app up and running.

Why Flask
———————-
Minimalism and simplicity:
Flask is very small (~2K lines of code) and the learning curve to start developing apps with it is very short. No restrictions and free way to implement everything as you want (bad or good, depends on you, fully).

No ORM and database access layer:
I personally do not like ORMs, which bring additional complexity to the development. Of course if you want to use something like SQLAlchemy – there are no problems to use it with Flask.

App structure and routing:
Application structure really depends on you, there are only some predefined requirements, but it is easy to overcome them too if you want. Routing system in Flask is also nice, I prefer to use decorators for the views to define the routes.

Blueprints and extensions:
Blueprints in Flask is like modules for your application. I personally prefer to separate all my modules in blueprints, have separate directories for them where I can also put models and other related things, like templates, statics (if needed and wanted). Also extensions – are easy to install and easy to plug in to your application. So as I mentioned earlier – Flask is very flexible.

Template engine:
Jinja2 is an amazing template engine and is integrated with Flask really well. Simple to use, powerful enough and extensible. I have wrote already custom filters for it, which is also easy to do. Also wrote functions which can be called from templates directly (added to the app context and then used in the templates), this is like a simulation of the great Django’s feature I liked to use – template tags.

Web server and debugging:
You can run built-in web server and have your app running without any worries on how to setup the nginx or apache to serve your app. Plus Flask comes with a nice in-browser debugger. Also you can use Flask debug toolbar extension and have even better debugging experience.

—————————————————————————————————————————
Please Like, Share, Comment and Subscribe for more videos and updates
—————————————————————————————————————————