Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TEMPLATE_DIRS is missing in settings.py (django 1.6)

Tags:

django

I am reading http://www.djangobook.com/en/2.0/chapter04.html which follows Django 1.4 but I use Django 1.6 so how to set the template directory in Django 1.6 as settings.py doesn’t have TEMPLATE_DIRS variable and why the developers changed this? Thanks in advance.

like image 782
venkatvb Avatar asked Dec 03 '13 14:12

venkatvb


2 Answers

Add to settings.py

from os.path import join
TEMPLATE_DIRS = (
    join(BASE_DIR,  'templates'),
)
like image 69
crazyzubr Avatar answered Oct 05 '22 06:10

crazyzubr


TEMPLATE_DIRS = (
    os.path.join(BASE_DIR,  'templates'),
)

Add this to settings.py. In django 1.6 BASE_DIR is defined. Otherwise define BASE_DIR as

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
like image 26
Mohammed Safeer Avatar answered Oct 05 '22 07:10

Mohammed Safeer