Commit 0c77c1b84f01f29fb72615c2a82f2cfdf48477f7
1 parent
72759f12af
Exists in
master
and in
1 other branch
Removed local server script. Use flashy-backend's instead
Showing 1 changed file with 0 additions and 34 deletions Side-by-side Diff
local_server.py
View file @
0c77c1b
1 | -from SimpleHTTPServer import SimpleHTTPRequestHandler | |
2 | -import SocketServer | |
3 | -import os | |
4 | - | |
5 | - | |
6 | -class SPARequestHandler(SimpleHTTPRequestHandler): | |
7 | - def send_head(self): | |
8 | - self.path = self.path.lstrip('/app') | |
9 | - path = self.translate_path(self.path) | |
10 | - f = None | |
11 | - if os.path.isdir(path): | |
12 | - for index in "index.html", "index.htm": | |
13 | - index = os.path.join(path, index) | |
14 | - if os.path.exists(index): | |
15 | - path = index | |
16 | - break | |
17 | - else: | |
18 | - return self.list_directory(path) | |
19 | - ctype = self.guess_type(path) | |
20 | - if ctype.startswith('text/'): | |
21 | - mode = 'r' | |
22 | - else: | |
23 | - mode = 'rb' | |
24 | - try: | |
25 | - f = open(path, mode) | |
26 | - except IOError: | |
27 | - return open('home.html', 'r') | |
28 | - self.send_response(200) | |
29 | - self.send_header("Content-type", ctype) | |
30 | - self.end_headers() | |
31 | - return f | |
32 | - | |
33 | -httpd = SocketServer.TCPServer(("", 80), SPARequestHandler) | |
34 | -httpd.serve_forever() |