这个提示大概是说:“类型错误:不支持操作类型为字符串和字符串”,直接把两个字符串(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. Leetcode No.122 Best Time to Buy and Sell Stock II Easy(c++实现)

    1. 题目 1.1 英文题目 You are given an array prices where prices[i] is the price of a given stock on the it ...

  2. Filter+Listener核心技术

    一.filter过滤器 javaweb三大组件:filter.listener.servlet. 过滤器是向web应用程序的请求和响应处理添加功能的web服务组件,可以在访问资源之前对请求和响应进行修 ...

  3. RWLock——一种细粒度的Mutex互斥锁

    RWMutex -- 细粒度的读写锁 我们之前有讲过 Mutex 互斥锁.这是在任何时刻下只允许一个 goroutine 执行的串行化的锁.而现在这个 RWMutex 就是在 Mutex 的基础上进行 ...

  4. Min25 筛与 Powerful Numbers

    Min25 筛与 Powerful Numbers Min25 筛 大喊一声 Min25 NB!!! 这是一个非常神奇的东西,用于求更加普遍的积性函数的前缀和. 比如我们要求 \(\sum_{i=1} ...

  5. 基于Mininet的网络拓扑搭建代码

    1 import logging 2 import os 3 import time 4 import thread 5 import multiprocessing 6 7 from mininet ...

  6. 2018年成为Web开发者的路线图

    本文通过一组大图展示了Web开发技能图谱,给出了作为Web 开发者可以采取的路径,以及总结了想要成为Web工程师的朋友们.希望和大家一起交流分享 介绍 Web 开发的角色一般说来,包括前端.后端和de ...

  7. Centos7 安装Oracle11g Express Edition

    Centos7 安装Oracle11g Express Edition 下载地址:https://download.oracle.com/otn/linux/oracle11g/xe/ 一.安装相关依 ...

  8. [考试总结]noip模拟17

    爆零了! 菜爆了 弱展了 垃爆了 没有什么可以掩饰你的菜了 这次考试为我带来了第一个 \(\color{red}{ \huge{0}}\) 分,十分欣慰.... 最近的暴力都打不对,你还想什么正解?? ...

  9. Debian10 / Ubuntu 20.10 /Linux Mint 20安装Microsoft Edge浏览器Dev版(每周更新)

    安装方法如下: 打开终端命令,切换到 管理员身份,输入如下安装命令即可在Linux下使用 Microsoft Edge 浏览器了 ## Setup curl https://packages.micr ...

  10. 版本号是通过import合并而来的,不是继承来的