Reputation: 12037
In the new template for settings django 1.6 generates the following code:
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
However this has never worked for me and I keep changing it to
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
Is their code wrong or am I missing something? The idea of this BASE_DIR is to avoid hardcoding dir names.
Upvotes: 0
Views: 1130
Reputation: 2202
The idea behind os.path.dirname(os.path.dirname(__file__))
is to get two directories above your settings directory.
Your code os.path.abspath(os.path.dirname(__file__))
is the same as os.path.dirname(__file__)
.
You probably changed where your settings.py resides and for that you must change its path.
Upvotes: 1