Visualizer work
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
879 B

import http.server
import socketserver
import os
PORT = 8000
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
# Disable caching for all files
self.send_header('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
self.send_header('Pragma', 'no-cache')
self.send_header('Expires', '0')
super().end_headers()
def log_message(self, format, *args):
# Optional: cleaner logging
super().log_message(format, *args)
Handler = MyHTTPRequestHandler
print(f"Starting server on http://127.0.0.1:{PORT}")
print("Cache-busting enabled: Browser will always fetch latest files.")
with socketserver.TCPServer(("", PORT), Handler) as httpd:
try:
httpd.serve_forever()
except KeyboardInterrupt:
print("\nServer stopped.")
httpd.server_close()