Port www from php to python using Flask framework