django:
返回中文字符串ok,返回json中文乱码
解:json.dumpd(dd,ensure_ascii=False)
模板继承报错
解:需要添加路径{%extends ./base.html%}
python2.7 unicode和string类型
>>> ss=u'dddd'+'dddddd'
>>> type(ss)
<type 'unicode'>
>>> s='ddd'+'dddd'
>>> type(s)
<type 'str'>
>>>
selenium构造report的时候报错
IOError: [Errno 22] invalid mode ('w+') or filename: 'D:\work\report\20180523_15:27:27re.html'
解:因为文件名不能含有特殊符号:,修改文件名格式
django models增加一个字段,makemigrations报错
we can't do that (the database needs something to populate existing rows).
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null
value for this column)
2) Quit, and let me add a default in models.py
Select an option: Traceback (most recent call last):
解:设置新增字段null=True
age = CharField(max_length=10, null=True)