# The dev server: app/ at http://127.0.0.1:8002, with caching off, so a # reload always gets the current modules (a browser mixing cached old ones # with new ones breaks the page). import functools import http.server import os ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'app') class NoCache(http.server.SimpleHTTPRequestHandler): def end_headers(self): self.send_header('Cache-Control', 'no-store') super().end_headers() if __name__ == '__main__': handler = functools.partial(NoCache, directory=ROOT) port = int(os.environ.get('PORT', 8002)) with http.server.ThreadingHTTPServer(('127.0.0.1', port), handler) as server: print(f'Serving app/ at http://127.0.0.1:{port} (no caching)') server.serve_forever()