这个提示大概是说:“类型错误:不支持操作类型为字符串和字符串”,直接把两个字符串(BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))在前面定以为基础路径,也就是整个项目的路径)在列表中连接起来是不合适的,这里系统将“/”理解为了除号,系统理解为“字符串/字符串”。实际上这里想表达的意思将BASE_DIR 和’templates’连在一起形成一个完整路径,而“/”是路径分隔符。

解决方案:将settings.py中的'DIRS': [BASE_DIR / 'templates'] 修改为 'DIRS': [str.format(BASE_DIR,'/templates']

或者'DIRS': [('%s/templates') % BASE_DIR]

或者 'DIRS': [os.path.join(BASE_DIR, 'templates')] 也可以解决

PyCharm启动报错 TypeError: unsupported operand type(s) for /: ‘str’ and ‘str’ 解决的更多相关文章

  1. python pip install 报错TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' Command "python setup.py egg_info" failed with error code 1 in

    pip install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl ...

  2. 解决pip安装时出现报错TypeError unsupported operand type(s) for -= 'Retry' and 'int'

    1.参考 https://stackoverflow.com/questions/42610545/typeerror-unsupported-operand-types-for-retry-and- ...

  3. python TypeError: unsupported operand type(s) for +: 'int' and 'str' [closed]

    TypeError: unsupported operand type(s) for +: 'int' and 'str' [closed] sql="insert into auto_tr ...

  4. TypeError: unsupported operand type(s) for +: 'float' and 'decimal.Decimal'

    TypeError: unsupported operand type(s) for +: 'float' and 'decimal.Decimal' 浮点型和双精度类型 相加报错 from deci ...

  5. python3.x元组打印错误 TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'

    原创by南山南北秋悲 欢迎引用!请注明原地址:http://www.cnblogs.com/hwd9654/p/5676746.html  谢谢! TypeError: unsupported ope ...

  6. python TypeError: unsupported operand type(s) for +: 'geoprocessing value object' and 'str'

    TypeError: unsupported operand type(s) for +: 'geoprocessing value object' and 'str' if self.params[ ...

  7. tomcat启动报错:Unsupported major.minor version 51.0

    myeclipse中添加项目后,发现项目启动时报错:Unsupported major.minor version 51.0 因为tomcat使用的jdk版本不支持你项目的jdk版本,需要你在myec ...

  8. python2.7 使用super关键词 报错 TypeError: must be type, not&n

    错误试验代码: class Base(): def meth(self): print "i'm base" class Derived(Base): def meth(self) ...

  9. python 报错TypeError: 'range' object does not support item assignment,解决方法

    贴问题 nums = range(5)#range is a built-in function that creates a list of integers print(nums)#prints ...

随机推荐

  1. 发送 email (转)

    <?phpnamespace app\common\controller;//基类class Email{ /* Public Variables */ var $smtp_port; var ...

  2. .NET 6 Preview 6 正式发布: 关注网络开发

    微软.NET 团队的项目经理在博客上发布了.NET 6 Preview 6,  在候选发布阶段之前的倒数第二个预览版,也就是8月份还会发布一个Preview 7,9月份开始进入RC,两个候选版本将专注 ...

  3. python使用笔记21--发邮件

    发邮件需要第三方模块 pip install yamail 1 #import yagmail #--别人写的,发中文附件的时候是乱码 2 import yamail #牛牛基于yagmail改的 3 ...

  4. C语言:逻辑运算符||

    #include <stdio.h> //逻辑运算符||特点:左右两边的表达式先做左边,如果左边为1则右边不用执行,整个结果为1:如果左边为0,再执行右边: main() { int x= ...

  5. 何为“Secure Contexts”安全内容? 终于说明白了!

    ​​​何为"Secure Contexts"安全内容? 终于说明白了! 看图说话 [途径1]:地址栏输入: edge://flags/ 按需设置选项后,重启浏览器即可. Allow ...

  6. java并发编程基础——线程通信

    线程通信 当线程在系统内运行时,程序通常无法准确的控制线程的轮换执行,但我们可以通过一些机制来保障线程的协调运行 一.传统的线程通信 传统的线程通信主要是通过Object类提供的wait(),noti ...

  7. Leetcode13. 罗马数字转整数Leetcode14. 最长公共前缀Leetcode15. 三数之和Leetcode16. 最接近的三数之和Leetcode17. 电话号码的字母组合

    > 简洁易懂讲清原理,讲不清你来打我~ 输入字符串,输出对应整数 ![在这里插入图片描述](https://img-blog.csdnimg.cn/63802fda72be45eba98d9e4 ...

  8. ifix历史数据(H04/H08/H24)转换为CSV文件导出

    在最近的一次环保数据维护中,由于自己疏忽导致数据库中TP值并未有效记录,还好历史趋势有相关记录,问题是我该如何将.H24文件记录导出?在逛论坛后,无意发现一款工具解决了我的燃眉之急-HTD2CSV.e ...

  9. SpringBoot整合Guacamole教程

    前言 本文主要介绍的是SpringBoot如何整合Guacamole在浏览器是远程桌面的访问. Guacamole 介绍 Apache Guacamole 是一个无客户端远程桌面网关.它支持标准协议, ...

  10. Scrapy入门到放弃04:下载器中间件,让爬虫更完美

    前言 MiddleWare,顾名思义,中间件.主要处理请求(例如添加代理IP.添加请求头等)和处理响应 本篇文章主要讲述下载器中间件的概念,以及如何使用中间件和自定义中间件. MiddleWare分类 ...