import sys import os #print(f"PWD: {os.getcwd()}", file=sys.stderr) #print(f"Environ: {os.environ}", file=sys.stderr) sys.path.insert(0, "/root/ipz-server-1/server/cgi/") from view import View from httputils import parse_query query_dict = parse_query(os.environ['QUERY_STRING']) view = View(query_dict) html_page = view.render_page() page_length = len(html_page.encode("UTF-8")) print(f"Content-Type: text/html; charset=UTF-8\r\n" + \ f"Content-Length: {page_length}\r\n" + \ f"\r\n" + \ f"{html_page}")