#!/usr/bin/env python # # This is an example Python web app. # import textwrap, sys from http.server import BaseHTTPRequestHandler, HTTPServer from datetime import date class HelloRequestHandler(BaseHTTPRequestHandler): def do_GET(self): if self.path != '/': self.send_error(404, "Object not found") return self.send_response(200) self.send_header('Content-type', 'text/html; charset=utf-8') self.end_headers() python_info = "{}.{}.{}".format(sys.version_info[0], sys.version_info[1], sys.version_info[2]) response_text = textwrap.dedent('''\ Your default homepage | ProfiWeb

This is an example Python web app

''').format(python_info, date.today().year) self.wfile.write(response_text.encode('utf-8')) server_address = ('', 8001) httpd = HTTPServer(server_address, HelloRequestHandler) httpd.serve_forever()