以前是这样的:
from django.template.loader import get_template from django.template import Context htmly = get_template('email/contact.html') d = Context({'contact': contact, 'attachments': attachments}) html = htmly.render(dt)如果异常:TypeError: context must be a dict rather than Context. …
在Google Search Console上看到公司的20多个链接显示如标题错误,比如 https://www.moorol.com/en/product/led-bulb-works-with-amazon-echo-alexa/ 是因为页面里镶嵌了一段Rich Snippet(现在叫Rich Results)的代码:
<script type="application/ld+json"> { "@context" : "http://schema.org", "@type" : "Product", "name" : "LED bulb works with Alexa, Amazon Echo", "image" : "https://www.moorol.com/media/images/product/standard/adb5127158924af696d7b3877d36abd8.jpg", "description" : …如果续期Let's Encrypt老是报如下错误:
Attempting to renew cert (laonan.net) from /etc/letsencrypt/renewal/laonan.net.conf produced an unexpected error: The manual plugin is not working; there may be problems with your existing configuration.
The …
因为Mac里的brew一下子把我的python升级到3.7还不能回滚,所以tensorflow只能安装在树莓派上。。。接下来只能用vim写tensorflow的代码了?
服务器上修改了ssh端口,本地git push被拒,查了一下,全是github上怎么改成https方式的办法。。。你们就没有人自己建git服务器吗?闲置的VPS送给我啊。。。
自己动手,丰衣足食,其实也很简单,
首先,.ssh/config里增加一段:
# gitolite server Host mygitserver HostName 111.222.11.22 Port 11111 User git然后,到项目目录下,.git/config里,修改你的IP地址或原host为:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = …用树莓派看电影,加载srt中文字幕时老是闪退并报错,
omxplayer.bin: SubtitleRenderer.cpp:133: SubtitleRenderer::load_glyph(SubtitleRenderer::InternalChar)::: Assertion `!vgGetError()' failed. /usr/bin/omxplayer: 行 67: 1039 已放弃 LD_LIBRARY_PATH="$OMXPLAYER_LIBS${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $OMXPLAYER_BIN "$@"老婆大人很不满,说干嘛要用你这破玩意儿。
找到一个解决方案(未验证),先搁这
在/boot/config.txt里加一行 gpu_mem=128,加大GPU缓存
来源:https://github.com/huceke/omxplayer/issues/231
在之前的版本这么配置没有问题,但在新的1.14上就有问题了(以let's encrypt为例)
server { listen 443 ssl; server_name a.com; return 301 https://www.a.com$request_uri; } server { listen 443 ssl; server_name www.a.com; ... ssl_certificate /etc/letsencrypt/live/a.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/a.com/privkey.pem; }一直不成功,改为下面:
server { listen …升级一个应用到python3.7 + django2.1时,在生产环境上debug设置为false一直报错,不是那个ALLOWED_HOSTS问题,从gunicorn排除到nginx,最后怀疑是国际化问题(因为一直无法自动跳转,要手动输入带前缀的完整url,比如输入http://www.a.com/要报错,但是http://www.a.com/en/就没事),搞了一个下午加一个晚上,未果,在nginx的日志里又看不出什么端倪出来。
早上发现这篇文章,https://code.i-harness.com/en/q/e6d647
在settings里设置DEBUG_PROPAGATE_EXCEPTIONS = True,找到代码中的问题(其实不是国际化的问题。。。),修复之
在python3 + django2.x之上,安装时指定版本 pip install django-modeltranslation==0.13b3, 不然可能会出一些幺蛾子出来。
仓皇出逃
所有春节习俗,都来自农耕社会。但又还没进化成适应商业社会只有象征意义的节日。
不懂编程的人看到这个标题会不会打我。。。I 服了 U的那种感觉。
django admin里的自定义action很有用,message提示也很友好,但是今天想报一个错,换了网上几种方法,死活都是绿色小勾的成功样式。
self.message_user(request, _('Clone more than one product at a time is not allowed.'), level=messages.ERROR)那个level屁用没有,查半天后端。。。后来想了下,查查前端?结果发现当设置成messages.ERROR的时候,class为"danger",而我的base.css没有这个样式,只有一个名为"error"的样式,改成如下,搞定。
self.message_user(request, _('Clone more than one product at a time is …谢土豪大半夜给我发微信,噼里啪啦发来几张作业的照片,说,我在辅导小孩功课,你能背这些诗不?这么多。
我说不能,要不你问一下群里那三个老师。
他说,要老子是国家主席,老子叫他们三个来喝酒,脑袋上一人顶一把枪,叫他们不许百度给我全背出来。
他娘的,还他妈的龟虽寿。