Search code examples
pythondjangotemplatesdjango-templatesdjango-project-architect

What is the best location to put templates in django project?


What is the best location to put templates in django project?


Solution

  • From the Django book, chapter 4:

    If you can’t think of an obvious place to put your templates, we recommend creating a templates directory within your Django project (i.e., within the mysite directory you created in Chapter 2, if you’ve been following along with our examples).

    This is exactly what I do, and has worked great for me.

    My directory structure looks something like this:

    /media for all my CSS/JS/images etc
    /templates for my templates
    /projectname for the main project code (i.e. the Python code)