Flask Swagger UI not able to find swagger.json Fetch error Not Found /static/swagger.json Flask API Docker

Solution
from pathlib import Path

# Getting the absolute path for the current file (views.py)
BASE_PATH = Path(__file__).resolve().parent

(...)

return send_from_directory(BASE_PATH.joinpath('static'), 'swagger.json')