diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-09-24 12:10:11 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-09-24 12:10:11 -0700 |
commit | e829cc0e89c81f7b6ba0b9cea1d2d95f84951308 (patch) | |
tree | e45fd4539a95a98af3e68615b8f5d21c7c4984d7 | |
parent | 5f5034e826eb98e730ac0cb357f4236982988053 (diff) | |
download | yt-local-e829cc0e89c81f7b6ba0b9cea1d2d95f84951308.tar.lz yt-local-e829cc0e89c81f7b6ba0b9cea1d2d95f84951308.tar.xz yt-local-e829cc0e89c81f7b6ba0b9cea1d2d95f84951308.zip |
server.py: support alternative server software
Add if __name__ == '__main__' check and add the name
"application" pointing to the callable.
Fixes #19
-rw-r--r-- | server.py | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -161,12 +161,15 @@ class FilteredRequestLog: if not self.filter_re.search(s): sys.stderr.write(s) +if __name__ == '__main__': + if settings.allow_foreign_addresses: + server = WSGIServer(('0.0.0.0', settings.port_number), site_dispatch, + log=FilteredRequestLog()) + else: + server = WSGIServer(('127.0.0.1', settings.port_number), site_dispatch, + log=FilteredRequestLog()) + print('Started httpserver on port' , settings.port_number) + server.serve_forever() -if settings.allow_foreign_addresses: - server = WSGIServer(('0.0.0.0', settings.port_number), site_dispatch, - log=FilteredRequestLog()) -else: - server = WSGIServer(('127.0.0.1', settings.port_number), site_dispatch, - log=FilteredRequestLog()) -print('Started httpserver on port' , settings.port_number) -server.serve_forever() +# for uwsgi, gunicorn, etc. +application = site_dispatch |