Currently it's the season of EuroDjangoCon and I'm reading various presentations. One interesting thing I'm seeing is that many people are using relative paths in their settings.py file but in different ways. (For reference, see Django and Relativity). So far I've seen:
-
os.path.dirname(__file__) -
os.path.abspath(os.path.dirname(__file__)) -
os.path.realpath(os.path.dirname(__file__))
I've reviewed the 3 ways provided here and looked at the Python source for verification. Let's talk about each one briefly...
1) dirname
PROJECT_ROOT = os.path.dirname(__file__)
While the above might work ...