Flask in Python



  • Flask is a web framework. It’s a Python module that lets you develop web applications easily. It’s has a small and easy-to-extend core.
  • It’s a micro framework that doesn’t include an ORM (Object Relational Manager) or such features.
  • It does have many cool features like URL Routing, template engine. It is a WSGI web app framework.
 Flask

Flask

What is WSGI ?

  • WSGI stands for “Web Server Gateway Interface”. It is used to forward requests from a web server (such as Apache or NGINX) to a backend Python web application or framework. From there, responses are then passed back to the webserver to reply to the requestor.
 Web Server Gateway Interface

Web Server Gateway Interface

What is Jinja2 ?

  • Jinja2 is a modern day templating language for Python developers. It was made after Django’s template. It is used to create HTML , XML or other markup formats that are returned to the user via an HTTP request.
 Jinja

Jinja

Flask Environment Setup

To install Python flask on the system, You need to have python 2.7 or higher installed on our system.

  • Install virtual environment (virtualenv)
  • virtualenv is considered as the virtual python environment builder which is used to create the multiple python virtual environment side by side. It can be installed by using the following command.
$ pip install virtualenv
  • Once it is installed, we can create the new virtual environment into a folder as given below.
$ pip install virtualenv
  • To activate the corresponding environment, use the following command
$ venv/bin/activate
  • On windows, use the following command.
$ venv/bin/activate
$ venv\scripts\activate
  • We can now install the flask by using the following command.
$ pip install flask
  • However, we can install the flask using the above command without creating the virtual environment.




Related Searches to Flask in Python