Flask introduction

Flask is a python microframework for building web applications or for rapid prototyping one.

sudo easy_install virtualenv
python3 -m venv venv --- create a venv directory for the project
source venv/bin/activate -- activate the virtual env.
pip install flask -- install flask

The idea for virtual environment is to import packages like flask only in a copy of the python
Virtual environment and not pollute the global python installation.

An example flask application:


from flask import Flask, render_template
app = Flask(__name__)

def index():
    return render_template('index.html')

def user(name):
    return render_template('user.html', name=name)

if __name__ == '__main__':


Hello, {{ name }}!

Python hello.py

It will start the web server

It should o/p Hello, watsh in browser.


Popular posts from this blog

Resolution for “No buffer space available (maximum connections reached?): JVM_Bind” issue

Using Quartz Scheduler in a Java EE Web Application

Using NPIV port for RDM disk access in VMware vSphere