【发布时间】:2014-12-28 17:06:31
【问题描述】:
我有用于 python 页面的带有 WSGI 模块的 apache 服务器。
我有带有 str(datetime.datetime.now()) 的 index.wsgi 文件,它打印当前时间戳。
问题是当我刷新页面时,我看不到它更新,它会在几秒之间跳转,看起来缓存中有 3-4 个旧结果并且正在显示它们..
我试图查看它是否在网络浏览器上使用缓存但找不到任何东西..
index.wsgi:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import datetime
html="""
<HTML>
<HEAD><TITLE>Manual Runner</TITLE>
<BODY>
timestamp: {0}<BR><BR>
</BODY></HTML>
""".format(str(datetime.datetime.now()))
def application (env, r):
body = html
status = '200 OK'
response_headers = [ ('Content-Type', 'text/html'), ('Content-Length', str (len (body) ) ) ]
r (status, response_headers)
return [body]
httpd.conf:
WSGIScriptAlias / /web_manager/manual_run/index.wsgi
<Directory /web_manager/manual_run>
Order allow,deny
Allow from all
Options +ExecCGI
AddHandler cgi-script .py
DirectoryIndex index.wsgi
</Directory>
有什么想法吗?!
谢谢。
【问题讨论】:
-
你能显示你的 index.wsgi 文件吗?
-
...以及 Apache 主机配置的相关部分,可能还有网络服务器响应的标头。