首页 > 解决方案 > 刷新后Http服务器显示相同的页面?

问题描述

我有一段代码用于在http servers. 我首先做的是设置我的http server in python and type it in my web browser, listening on port8000 . However when i delete theindex.html and stopped thepython` 脚本并在我的网络浏览器上点击刷新,它仍然显示相同的页面!顺便说一句,我目前正在使用 Firefox 开发者版。

图片链接

我尝试用index.html另一个不同的网站替换index.html它进行测试,但它没有显示新网站。

import http.server
import socketserver

PORT = 8000

Handler = http.server.SimpleHTTPRequestHandler

with socketserver.TCPServer(("", PORT), Handler) as httpd:
    print("serving at port", PORT)
    httpd.serve_forever()

index.html我希望网络浏览器在关闭python脚本后停止显示。请帮助修复我的代码,使其停止显示相同的index.html

标签: pythonhttp

解决方案


欢迎来到stackoverflow。我认为您的问题与缓存有关!您可以尝试ctrl+f5在浏览器上点击以查看它是否有效。


推荐阅读