make gateway proper to run with mod_wsgi