neddit

the frontend of the frontpage of the internet  https://neddit.ce9e.org
git clone https://git.ce9e.org/neddit.git

commit
daf91f775623331acc97fd0e37513584170dfb7d
parent
eda9aed4d363e669a60e7160cb055efa41ca2ad1
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-10-03 04:26
add cli

python -m aiohttp.web adds logging which cannot be disabled

Diffstat

M neddit.py 9 +++++++--

1 files changed, 7 insertions, 2 deletions


diff --git a/neddit.py b/neddit.py

@@ -1,3 +1,4 @@
   -1     1 import argparse
    1     2 import re
    2     3 import functools
    3     4 from datetime import datetime
@@ -108,8 +109,12 @@ async def generic(request):
  108   109     return web.Response(body=tpl.render(**context), content_type='text/html')
  109   110 
  110   111 
  111    -1 def create_app(argv=[]):
   -1   112 if __name__ == '__main__':
   -1   113     parser = argparse.ArgumentParser()
   -1   114     parser.add_argument('--port', type=int, default=8000)
   -1   115     args = parser.parse_args()
   -1   116 
  112   117     app = web.Application()
  113   118     app.router.add_static('/static', 'static')
  114   119     app.router.add_route('GET', '/{path:.*}', generic)
  115    -1     return app
   -1   120     web.run_app(app, host='localhost', port=args.port)