annotate Resources/CodeGeneration/testWasmIntegrated/serve.py @ 1286:ddb6676bbcbf bugs/2020-02-invisible-slice

Added Histogram functions (new files: ImageToolbox...)
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 14 Feb 2020 14:59:32 +0100
parents 6d62fc8a6988
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
498
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
1 # -*- coding: utf-8 -*-
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
2 # tested on python 3.4 ,python of lower version has different module organization.
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
3 # from https://gist.github.com/HaiyangXu/ec88cbdce3cdbac7b8d5
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
4 import http.server
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
5 from http.server import HTTPServer, BaseHTTPRequestHandler
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
6 import socketserver
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
7
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
8 PORT = 8080
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
9
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
10 Handler = http.server.SimpleHTTPRequestHandler
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
11
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
12 Handler.extensions_map = {
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
13 '.manifest': 'text/cache-manifest',
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
14 '.html': 'text/html',
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
15 '.png': 'image/png',
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
16 '.jpg': 'image/jpg',
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
17 '.svg': 'image/svg+xml',
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
18 '.wasm': 'application/wasm',
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
19 '.css': 'text/css',
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
20 '.js': 'application/x-javascript',
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
21 '': 'application/octet-stream', # Default
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
22 }
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
23
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
24 httpd = socketserver.TCPServer(("", PORT), Handler)
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
25
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
26 print("serving at port", PORT)
6d62fc8a6988 Web demonstrator for codegen ongoing work
bgo-osimis
parents:
diff changeset
27 httpd.serve_forever()