本文主要是介绍Django报错TypeError: descriptor ‘format‘ for ‘str‘ objects doesn‘t apply to a ‘WindowsPath‘ object,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Django报错TypeError: descriptor ‘format’ for ‘str’ objects doesn’t apply to a ‘WindowsPath’ object
原因:str字符串写法异常
更改为:
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates',# 'DIRS': [os.path.join(BASE_DIR, 'templates')],'DIRS': str(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',],},},
]
这篇关于Django报错TypeError: descriptor ‘format‘ for ‘str‘ objects doesn‘t apply to a ‘WindowsPath‘ object的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!