From 1019ea1ed341e3a7769c046aa0be5764789360b6 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 2 Jun 2024 14:38:13 +0200 Subject: Migrate to Rust and Hyper With sanic, downloading a file locally is around ten times slower than with Rust and hyper. Maybe `pypy` could have helped, but I didn’t succeed to set it up quickly with the dependencies. --- src/main.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 src/main.py (limited to 'src/main.py') diff --git a/src/main.py b/src/main.py deleted file mode 100644 index b678aae..0000000 --- a/src/main.py +++ /dev/null @@ -1,28 +0,0 @@ -import sanic -import os - -import controller - -app = sanic.Sanic("Files") - -@app.get("/") -async def index(request): - return controller.index() - -@app.post("/", stream = True) -async def upload(request): - return await controller.upload(request) - -@app.get("/") -async def file_page(request, file_id): - return await controller.file(file_id, download = False) - -@app.get("//download") -async def file_download(request, file_id): - return await controller.file(file_id, download = True) - -app.static("/static/", "static/") - -if __name__ == "__main__": - debug = 'DEBUG' in os.environ and os.environ['DEBUG'] == 'TRUE' - app.run(debug=debug, access_log=True) -- cgit v1.2.3