Skip to content

Instantly share code, notes, and snippets.

@marthall
Last active December 19, 2015 08:49
Show Gist options
  • Save marthall/5928658 to your computer and use it in GitHub Desktop.
Save marthall/5928658 to your computer and use it in GitHub Desktop.
Hvordan definere template dirs i et Djangoprosjekt
# 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