Andy Bavier | 3dcbe9b | 2016-03-07 16:20:45 -0500 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import BaseHTTPServer |
Matteo Scandolo | 963efd7 | 2016-03-10 08:59:27 -0800 | [diff] [blame^] | 4 | |
| 5 | |
Andy Bavier | 3dcbe9b | 2016-03-07 16:20:45 -0500 | [diff] [blame] | 6 | class HTTPHandlerOne(BaseHTTPServer.BaseHTTPRequestHandler): |
Matteo Scandolo | 963efd7 | 2016-03-10 08:59:27 -0800 | [diff] [blame^] | 7 | def do_GET(self): |
| 8 | # with open('./message.html', 'r') as msgfile: |
| 9 | with open('../../../../templates/message.html.j2', 'r') as msgfile: |
| 10 | message = msgfile.read() |
| 11 | self.wfile.write(message) |
| 12 | |
Andy Bavier | 3dcbe9b | 2016-03-07 16:20:45 -0500 | [diff] [blame] | 13 | |
| 14 | def run(server_class=BaseHTTPServer.HTTPServer, |
| 15 | handler_class=BaseHTTPServer.BaseHTTPRequestHandler): |
Matteo Scandolo | 963efd7 | 2016-03-10 08:59:27 -0800 | [diff] [blame^] | 16 | # server_address = ('192.168.0.1', 8000) |
| 17 | server_address = ('127.0.0.1', 8000) |
Andy Bavier | 3dcbe9b | 2016-03-07 16:20:45 -0500 | [diff] [blame] | 18 | httpd = server_class(server_address, handler_class) |
| 19 | httpd.serve_forever() |
| 20 | |
| 21 | run(handler_class=HTTPHandlerOne) |