I am using the os module to have relative paths in my Django projects settings.py file. The variable SITE_ROOT is set to the current working directory of the
The command os.path.abspath(os.path.dirname(__file__)) returns the directory in which the code file is stored, but os.getcwd() gives you your current working directory which is by default where the code was executed, the latter can be changed using the os.chdir() command.