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

前端 未结 5 1740
感动是毒
感动是毒 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:30

    If you're working with a newer version of Django you may have to add it to the DIR list that is inside settings.py under TEMPLATES.

    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': ['[project name]/templates'], # Replace with your project name
            'APP_DIRS': True,
            'OPTIONS': {
                'context_processors': [
                    'django.template.context_processors.debug',
                    'django.template.context_processors.request',
                    'django.contrib.auth.context_processors.auth',
                    'django.contrib.messages.context_processors.messages',
                ],
            },
        },
    ]
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题