Added some mods to allow it run with nginx+uwsgi on marmot.