Created
June 12, 2013 15:16
-
-
Save soulston/5766202 to your computer and use it in GitHub Desktop.
Django absolute paths for settings.py (from https://snipt.net/kennethlove/django-absolute-paths-for-settingspy/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
# here() gives us file paths from the root of the system to the directory | |
# holding the current file. | |
here = lambda * x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x) | |
PROJECT_ROOT = here("..") | |
# root() gives us file paths from the root of the system to whatever | |
# folder(s) we pass it starting at the parent directory of the current file. | |
root = lambda * x: os.path.join(os.path.abspath(PROJECT_ROOT), *x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment