Flask hello world

Flask a web framework that can be used to build web apps with Python.

It’s very minimalist and lightweight, great for making a SaaS app.

Related course: Python Flask: Web Apps with Python

Flask Example

First install Flask, you can do so with pip.
Once installed copy the file below and save as

from flask import Flask

app = Flask(__name__)

def helloIndex():
return 'Hello World from Python Flask!''', port= 81)

Start with:


Python will show:

# python 
* Running on (Press CTRL+C to quit)

This means you have a web server running on port 81.

Open your web browser and type

This will show you the hello world message.

Flask hello world


We defined the route (‘/hello’) and mapped it to a function:

def helloIndex():
return 'Hello World from Python Flask!'

If you leave it blank you’ll have the index route.

Previous Post Next Post

Cookie policy | Privacy policy | ©

Web development

  • Python web application
  • Flask hello world
  • Flask vs django
  • twisted