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')
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')