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)