Pathlib Path Obtenha o diretório do arquivo atual
import pathlib
pathlib.Path(__file__).parent.absolute()
Pleasant Panda
import pathlib
pathlib.Path(__file__).parent.absolute()
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
TEMPLATES_DIR = BASE_DIR.joinpath('templates')