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

后端 未结 9 634
情歌与酒
情歌与酒 2020-12-07 13:29

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

9条回答
  •  感情败类
    2020-12-07 13:40

    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)

提交回复
热议问题