Mercurial > hg > orthanc-stone
comparison Deprecated/Resources/CodeGeneration/testWasmIntegrated/serve.py @ 1401:f6a2d46d2b76
moved CodeGeneration into Deprecated
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Wed, 29 Apr 2020 20:48:18 +0200 |
parents | Resources/CodeGeneration/testWasmIntegrated/serve.py@6d62fc8a6988 |
children |
comparison
equal
deleted
inserted
replaced
1400:419d0320c344 | 1401:f6a2d46d2b76 |
---|---|
1 # -*- coding: utf-8 -*- | |
2 # tested on python 3.4 ,python of lower version has different module organization. | |
3 # from https://gist.github.com/HaiyangXu/ec88cbdce3cdbac7b8d5 | |
4 import http.server | |
5 from http.server import HTTPServer, BaseHTTPRequestHandler | |
6 import socketserver | |
7 | |
8 PORT = 8080 | |
9 | |
10 Handler = http.server.SimpleHTTPRequestHandler | |
11 | |
12 Handler.extensions_map = { | |
13 '.manifest': 'text/cache-manifest', | |
14 '.html': 'text/html', | |
15 '.png': 'image/png', | |
16 '.jpg': 'image/jpg', | |
17 '.svg': 'image/svg+xml', | |
18 '.wasm': 'application/wasm', | |
19 '.css': 'text/css', | |
20 '.js': 'application/x-javascript', | |
21 '': 'application/octet-stream', # Default | |
22 } | |
23 | |
24 httpd = socketserver.TCPServer(("", PORT), Handler) | |
25 | |
26 print("serving at port", PORT) | |
27 httpd.serve_forever() |