新建django项目出现TypeError: unsupported operand type(s) for /: 'str' and 'str'问题

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        # 'DIRS': [BASE_DIR / 'templates']
        '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',
            ],

在settings.py中找到上面代码,把DIRS那行注释掉,用下面一行代替即可解决问题。

 

posted @ 2020-12-28 16:10  Bert-H  阅读(1135)  评论(0)    收藏  举报