user2988464 user2988464 - 1 year ago 124
Python Question

Django tuple checking: TEMPLATE_DIRS should be tuple?

I'm trying Django 1.7.

This is my TEMPLATE_DIRS setting:

os.path.join(os.path.dirname(__file__), 'templates').replace('\\', '/')

which is fine for Django 1.6, but doesn't work for Django 1.7.

Can someone explains this?

Answer Source

You need a trailing , for it to be a tuple, see below, the last ,

    os.path.join(os.path.dirname(__file__), 'templates').replace('\\', '/'),

When there's a single element in the tuple you need to leave a trailing comma at the end, e.g. (a,) is a tuple with single element a, but (a) just resolves to whatever a is.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download