这个提示大概是说:“类型错误:不支持操作类型为字符串和字符串”,直接把两个字符串(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. Jmeter之cokie管理器和http默认值

    根据上文中,都配置好以后就可以开始启动了,点击启动,线程组里面就会开始记录你的网页请求.这里使用CNode网站做测试.我分别记录进行了"登入","话题创建",& ...

  2. Java基础00-数据输入5

    1. 数据输入 1.1 数据输入概述 我们需要的数据(比如账号密码)并不是一开是就有的,而是要输入的. 1.2 Scanner使用的基本步骤 1.3 案例

  3. 如何在 PyCharm 中设置 Python 代码模板

    #!/usr/bin/env python # -*- coding: utf-8 -*- # Created by iFantastic on $DATE if __name__ == '__mai ...

  4. P4334 [COI2007] Policija

    P4334 [COI2007] Policija 题意 一个无重边的无向图,每次询问删掉一条边或删掉一个点后两个点是否联通. 思路 连通性问题,我们可以考虑使用广义圆方树解决. 对于删掉一个点的情况: ...

  5. GC垃圾回收机制详解

    JVM堆相关知识    为什么先说JVM堆?  JVM的堆是Java对象的活动空间,程序中的类的对象从中分配空间,其存储着正在运行着的应用程序用到的所有对象.这些对象的建立方式就是那些new一类的操作 ...

  6. 数据结构与算法-排序(二)选择排序(Selection Sort)

    摘要 选择排序的逻辑是先遍历比较出序列中最大的,然后把最大的放在最后位置. 遵循这个逻辑,用代码实现时,做到1.减少比较次数之外,这里引入一个新的指标 - 稳定性,2.保证排序过程中的稳定性也是一个优 ...

  7. odoo14在tree、kanban视图上添加dashboard

    效果图: 实现代码:js:view的类型原来1个js给拆分成了4个: view, controller, renderer, model 1.view:AbstractView的子类,这是工厂类:类需 ...

  8. 记录一次HSDB的使用遇到的问题 No such type.

    univese Unrecognized command. Try help... hsdb> universe Heap Parameters: Gen 0: eden [0x00000000 ...

  9. vue知识点---element el-date-picker 插件默认时间属性default-value怎么赋值?

    参考网址: http://www.imooc.com/wenda/detail/509359 默认值,你放到 v-model里面就好. v-model="time" data(){ ...

  10. vue源码阅读笔记

    1.yarn test [文件名]  -t [name-of-spec(describe or test )] 直接运行yarn test,会测试所有测试文件:yarn test 后面只跟文件名的话会 ...