##// END OF EJS Templates
Added webbroser to auto open the slideshow.
damianavila -
Show More
@@ -14,6 +14,8 b' Contains postprocessor for serving nbconvert output.'
14 #-----------------------------------------------------------------------------
14 #-----------------------------------------------------------------------------
15
15
16 import os
16 import os
17 import webbrowser
18
17 from BaseHTTPServer import HTTPServer
19 from BaseHTTPServer import HTTPServer
18 from SimpleHTTPServer import SimpleHTTPRequestHandler
20 from SimpleHTTPServer import SimpleHTTPRequestHandler
19
21
@@ -41,7 +43,10 b' class ServePostProcessor(PostProcessorBase):'
41 os.chdir(self.build_directory)
43 os.chdir(self.build_directory)
42 httpd = HTTPServer(('127.0.0.1', 8000), SimpleHTTPRequestHandler)
44 httpd = HTTPServer(('127.0.0.1', 8000), SimpleHTTPRequestHandler)
43 sa = httpd.socket.getsockname()
45 sa = httpd.socket.getsockname()
44 print("Serving " + input[2:] + " on http://" + sa[0] + ":" + str(sa[1]))
46 name = input[2:]
47 url = "http://" + sa[0] + ":" + str(sa[1]) + "/" + name
48 webbrowser.open(url, new=2)
49 print("Serving " + name + " on " + url)
45 print("Use Control-C to stop this server.")
50 print("Use Control-C to stop this server.")
46 httpd.serve_forever()
51 httpd.serve_forever()
47 except KeyboardInterrupt:
52 except KeyboardInterrupt:
General Comments 0
You need to be logged in to leave comments. Login now