djangodjango-settingsdjango-shell

How can I print the value of TEMPLATE_DIRS from the django interactive shell?


I would like to print this value for debugging purposes. How can I do it?

print TEMPLATE_DIRS doesn't work print settings.TEMPLATE_DIRS doesn't work.


Solution

  • Did you import the settings first?

    $steve ./manage.py shell
    
    Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
    
    In [1]: from django.conf import settings
    In [2]: settings.TEMPLATES[0]['DIRS']
    Out [2] ('/Volumes/HDD/usr/local/django/mytestproject/templates',)