The variable __file__
doesn't exist in a Python shell. So you can't just test the value like that.
The BASE_DIR
value will be equal the parent folder of the file where the line is situation. If you have a Django project and the line is in /home/xyz/foo/foo/settings.py
, then BASE_DIR
is equal to /home/xyz/foo
.
Why? __file__
returns the absolute path of the current file, here, our settings.py
. After, you are taking two times the folder. The first time it will take /home/xyz/foo/foo/
(it removes the file name in the path) and the second time it will take the parent folder. Hence, we arrive to the project main folder.
Also, you don't need to replace \\
by /
since the Python os.path
module know how to deal with this according to your current OS.
In summary, your current line point to a templates/
directory at the root of your Django project :)