add ProxyFix middleware to app for running behind proxy servers
fix pyflakes and pep8 errors