zoukankan      html  css  js  c++  java
  • (admin.E403) A ‘django.template.backends.django.DjangoTemplates’ instance must be configured in TEMPLATES in order to use the admin application.| 使用jinjia2时报错

    (admin.E403) A ‘django.template.backends.django.DjangoTemplates’ instance must be configured in TEMPLATES in order to use the admin application.| 使用jinjia2时报错

    1 问题分析

    (admin.E403) A ‘django.template.backends.django.DjangoTemplates’ instance must be configured in TEMPLATES in order to use the admin application.
    

    解读:(admin.E403)必须在TEMPLATES中配置'django.template.backends.django.DjangoTemplates'实例,才能使用管理应用程序。
    言下之意就是您的需要在您django项目下的setting中TEMPLATES增加django模板引擎。

    2 解决(linux系统下)

    2.1 修改django项目下setting中的TEMPLATES

    笔者本机地址为(您可以参考这来寻找):

    TEMPLATES = [
        {
            'BACKEND': 'django.template.backends.jinja2.Jinja2',
            'DIRS': [os.path.join(BASE_DIR,'templates'),],
            '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',
                ],
                'environment':'app.base_jinja2.environment' # 具体路径按照您实际的来            
            },
        },
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            'DIRS': [os.path.join(BASE_DIR, 'templates')]
            ,
            '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',
                ],
            },
        }   
    ]
    

    注意

    一定要把jinja2 引擎放在前面, 否则默认生效的还是django模板引擎.

  • 相关阅读:
    HCIA-Storage:第五章 常用存储协议介绍
    HCIA-Storage:SAN基础业务配置和使用:IPSAN,FCSAN
    RH2288v3常用的知识
    不常见的RAID,RAID2,RAID4,RAID7
    华为存储设备管理ip修改
    HCIA-Storage:第七章存储可靠性
    HCIA-Storage:第四章存储系统结构
    SSH服务见解
    shell学习笔记之正则表达式
    shell学习笔记之crontab
  • 原文地址:https://www.cnblogs.com/Bert-Sun/p/12575967.html
Copyright © 2011-2022 走看看