# import cProfile # import multiprocessing # import time # import requests # from fasthtml.common import * # from app import serve, weeks # PORT = 7860 # Update this to match the port your app is using # def run_server(): # serve() # This should start your FastHTML app # def make_requests(): # base_url = f"http://127.0.0.1:{PORT}" # # Test home page # try: # requests.get(f"{base_url}/") # except requests.exceptions.RequestException as e: # print(f"Error accessing home page: {e}") # n_weeks = 10 # for week in weeks[: min(n_weeks, len(weeks))]: # try: # requests.get(f"{base_url}/week/{week}") # except requests.exceptions.RequestException as e: # print(f"Error accessing week {week}: {e}") # # Add more requests here to cover other parts of your application # def profile_app(): # server_process = multiprocessing.Process(target=run_server) # server_process.start() # # Wait for the server to start # time.sleep(60) # try: # make_requests() # finally: # server_process.terminate() # server_process.join() # if __name__ == "__main__": # cProfile.run("profile_app()", "profile_output.prof") # print("Profiling complete. Run 'snakeviz profile_output.prof' to view results.")