I have a FastAPI app where I have mounted a directory for static files like:
api.mount("/static", StaticFiles(directory=os.path.join(this_directory, "static")))
When I deploy my FastAPI app to AWS, the API-gateway stage is called dev so all URL paths start with a /dev so in my HTML files, links like:
<script src="/static/js/jquery-3.6.0.min.js"></script>
Now no longer point to the correct location, instead, they need to point to
<script src="/dev/static/js/jquery-3.6.0.min.js"></script>
I can go through and change all the links to start with /dev but then when I want to make a production stage, the links will now start at /prod.
How can I set up Mangum/Uvicorn to deal with a different start path to the URL?
For reference, I set up my api-gateway using ANY to /{proxy+} resource of a lambda function with a FastAPI app.