Last active
December 19, 2015 08:49
-
-
Save marthall/5928658 to your computer and use it in GitHub Desktop.
Hvordan definere template dirs i et Djangoprosjekt
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
# Utdrag fra settings.py | |
# Dette gjøres gjerne i toppen av filen, så man kan bruke DIRPATH overalt | |
import os | |
DIRPATH = os.path.dirname(__file__) | |
# Dette blir pathen til alle globale templates, eller andre templates du vil inkludere | |
TEMPLATE_DIRS = ( | |
os.path.join(DIRPATH, 'templates/'), | |
) | |
TEMPLATE_LOADERS = ( | |
# Denne henter templates fra mappene under TEMPLATE_DIRS | |
'django.template.loaders.filesystem.Loader', | |
# Denne henter templates fra your_app/templates/your_app/template_name.html | |
'django.template.loaders.app_directories.Loader', | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment