Python 3 with Flask on!

Finally we can use Python 3 on with Flask to create app or sites or blogs or whatever you need to be on the web with the beauty of Python, the most elegant language ever.

In the following video you will see me exploring the remixed code to use flask with Python 3 on I talked about and flask in many posts, but I always used python 2 for that. Now I found this code and tried it on my sites and I saw all the benefits of this upgrade.


  • First: I use Python 3, so I am more at ease with it;
  • second: Python 2 will be non longer supported
  • third: it is faster, the changes on the site (even in the html files) are now immediate, while it took some minutes with python 2 (you could not predict when the changes would be applied and if there was something that was not going well, so now it is a pleasure to see immediately the effect of your modifications)

What you need to do it

You need these files:

  • package.json
  • watch.json


MD5=$(md5sum .requirements.txt | cut -f1 -d' ')
if ! [ -d ".data/$MD5-site-packages" ]; then
    rm -rf .data/*-site-packages
    pip3 install -U -r .requirements.txt -t ".data/$MD5-site-packages" 
exec env PYTHONPATH="$PWD/.data/$MD5-site-packages" python3


  "//1": "describes your app and its dependencies",
  "//2": "",
  "//3": "updating this file will download and update your packages",
  "name": "my-glitch-app",
  "version": "0.0.1",
  "description": "What am I about?",
  "scripts": {
    "start": "bash"
  "dependencies": {},
  "engines": {
    "node": "9.x"
  "repository": {
    "url": "!/my-glitch-app"
  "license": "MIT",
  "keywords": [



This will create just a line with two words (Hello World) in the page. To see how to create a complex site, go in the links at the end of the post.

from flask import Flask
app = Flask(__name__)

def hello():
  return "Hello World!"


The video with the live discovery of Python 3 on

Examples of sites with flask and python3

How to import the code you see in

Go in tool in the left bottom of the screen of the glitch page and then, from the menu, click on import from glitch (2 times). On the pop up window insert formazione/flask and you will get the code that you will personalize.

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.