V
V
vfvnvsyevsky2015-02-21 19:44:27
Django
vfvnvsyevsky, 2015-02-21 19:44:27

Is there a way to not hardcode template paths in django?

Actually a subject. Found only one way:

SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
TEMPLATE_DIRS = ( os.path.join(SITE_ROOT, 'templates'),)

But then Django looks for templates in the templates folders or at the app level or in its folders, but I didn’t think of how to make it look at the project level.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
un1t, 2015-02-21
@vfvnvsyevsky

By default, Janga searches at the application level, and then in the directories specified in TEMPLATE_DIRS.
Unless you've done nothing with TEMPLATE_LOADERS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question