direction change- use flask instead of django