在settings中添加代码如下获取templates路径:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 import os 2 import os.path 3 4 BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 5 6 7 TEMPLATE_DIRS = ( 8 os.path.join(BASE_DIR, 'templates'), 9 os.path.join(os.path.dirname(__file__), 'templates').replace('\', '/'), 10 )