mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 09:39:01 +08:00
Add reference to owner j0hnlittle
set web port as variable add some help to launch browser on startup Thanks again @j0hnlittle
This commit is contained in:
parent
5f8ecc4d2f
commit
9c903389a7
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
#original file and idea come from https://github.com/j0hnlittle
|
||||||
|
|
||||||
import SimpleHTTPServer, SocketServer
|
import SimpleHTTPServer, SocketServer
|
||||||
import sys
|
import sys
|
||||||
@ -9,6 +10,7 @@ import re
|
|||||||
#Replace this with a different path if you need to...
|
#Replace this with a different path if you need to...
|
||||||
base_path = os.path.join(os.getcwd(),"..","esp8266","data")
|
base_path = os.path.join(os.getcwd(),"..","esp8266","data")
|
||||||
tools_path = os.getcwd();
|
tools_path = os.getcwd();
|
||||||
|
server_port=8080
|
||||||
|
|
||||||
class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
@ -91,9 +93,13 @@ if __name__ == '__main__':
|
|||||||
print "="*60
|
print "="*60
|
||||||
print "Serving files from:"
|
print "Serving files from:"
|
||||||
print base_path
|
print base_path
|
||||||
|
print "\ntags.json is located at:"
|
||||||
|
print tools_path
|
||||||
|
print "\nOpen your browser at http://localhost:" + str(server_port)
|
||||||
|
|
||||||
os.chdir(base_path)
|
os.chdir(base_path)
|
||||||
print "="*60
|
print "="*60
|
||||||
handler = MyHandler
|
handler = MyHandler
|
||||||
server = SocketServer.TCPServer(("",8080), handler)
|
server = SocketServer.TCPServer(("",server_port), handler)
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user