support for both wsgi and manual server startup