Reduce duplicate code in wsgi files.