My code from the Flask Mega-Tutorial by Miguel Grinberg