Replace PHP interface with Flask based Python interface

Use jinja2 for templating and redis for getting unique ids