Convert from Google App Engine to Flask