python - tornado的static_url函数失效如何排查原因?
PHP中文网
PHP中文网 2017-04-17 17:43:50
0
1
319

tornado的static_url函数说明如下:

static_url函数创建了一个基于文件内容的hash值,并将其添加到URL末尾(查询字符串的参数v)

在模块文件中设置:{{ static_url("img/captcha.png") }}
可以在浏览页面查看源码时看到类似:/static/img/captcha.png?v=fab8d818a22a90d8ff6136a9dc60ba17这样的结果

开发环境是Ubuntu,已经实现相关功能。刷新页面时,v后面的hash值会改变。

生产环境是Centos,部署上去时,却发现刷新页面,v值不变。

用了nginx做反向代理,配置稍有不同,但都没在nginx设置静态文件路径。其他环境一致,找了很久也不知道是什么问题。

小白一枚,求指教排查static_url函数失效原因的思路。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
大家讲道理

Asker: Finally found the problem. . .

"debug": True  # 生产环境记得删

Just set it here and delete this sentence when deploying to the production environment.

The question comes again: when debug is False, how to solve the problem of refreshing the verification code image? Using ajax technology or what?

Please ask the passing masters to answer this question. . .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!