Python absolute path of file, dirname, join
Python absolute path of file, dirname, join
import os print(__file__) print(os.path.abspath(__file__)) print(os.path.dirname(__file__)) print(os.path.dirname(os.path.abspath(__file__))) print(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) BASE_DIR = os.path.dirname(os.path.abspath(__file__)) print(os.path.join(BASE_DIR,"templates"))