What is the path for TEMPLATE_DIRS in django settings.py when using virtualenv

前端 未结 5 1734
感动是毒
感动是毒 2021-01-05 02:15

I am using virtualenv and I want to know what the TEMPLATE_DIRS in settings.py should be, for example if I make a templates folder in the root of m

5条回答
  •  别那么骄傲
    2021-01-05 02:45

    the PROJECT_DIR has not been defined... the PROJECT_DIR is not a variable. its a directory/ a path to where the folder "templates" is located. This should help

    import os
    PROJECT_DIR = os.path.dirname(os.path.dirname(__file__))
    TEMPLATE_DIRS = os.path.join(PROJECT_DIR, 'templates')
    

提交回复
热议问题