请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

settings 问题

?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DIRS.

在添加上xadmin 出现这样的警告!

正在回答 回答被采纳积分+3

2回答

bobby 2017-10-17 09:37:38
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            root("templates"), #### Here ####
        ],
        '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',
            ],
        },
    },]

这个就是说 setting中的template目录应该这样设置

0 回复 有任何疑惑可以回复我~
  • 提问者 godclass #1
    谢谢老师 已经自己解决了,我想知道您给出的root(“templates”) 这个root是定义好的嘛?还是第三方包。
    之前出现问题后 我就在后面添加了TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'),) 后来把改 DIR=[os.path.join(BASE_DIR, '')],了 然后今天把 TEMPLATE_DIRS 注释了把DIRS改过来了 就没有警告了! 谢谢老师耐心的回答。
    回复 有任何疑惑可以回复我~ 2017-10-18 18:05:33
bobby 2017-10-13 09:44:28

亲 你使用的django是哪个版本的? 现在有没有造成不能启动?

0 回复 有任何疑惑可以回复我~
  • 提问者 godclass #1
    现在可以正常使用,只是一个警告。老师 我使用的django版本是1.11.6  ,一下是因为所有的包:是因为版本问题吗?
    certifi (2017.7.27.1)
    chardet (3.0.4)
    coreapi (2.3.3)
    coreschema (0.0.4)
    diff-match-patch (20121119)
    Django (1.11.6)
    django-crispy-forms (1.6.1)
    django-filter (1.0.4)
    django-formtools (2.1)
    django-guardian (1.4.9)
    django-import-export (0.5.1)
    django-reversion (2.0.10)
    djangorestframework (3.7.0)
    et-xmlfile (1.0.1)
    future (0.16.0)
    httplib2 (0.10.3)
    idna (2.6)
    itypes (1.1.0)
    jdcal (1.3)
    Jinja2 (2.9.6)
    Markdown (2.6.9)
    MarkupSafe (1.0)
    mysqlclient (1.3.12)
    odfpy (1.3.5)
    openpyxl (2.4.8)
    pip (9.0.1)
    pytz (2017.2)
    PyYAML (3.12)
    requests (2.18.4)
    setuptools (28.8.0)
    six (1.11.0)
    tablib (0.12.1)
    unicodecsv (0.14.1)
    uritemplate (3.0.0)
    urllib3 (1.22)
    wheel (0.30.0)
    xlrd (1.1.0)
    xlwt (1.3.0)
    回复 有任何疑惑可以回复我~ 2017-10-16 06:17:18
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号