Refactor wsgi.main to use get_internal_wsgi_app