mirror of
https://github.com/vale981/ablog
synced 2025-03-06 01:31:39 -05:00
Fixed serve command to work with python 3.
This commit is contained in:
parent
e1ac1b020e
commit
a99b6d0b36
1 changed files with 10 additions and 4 deletions
|
@ -181,12 +181,18 @@ def ablog_serve(website=None, port=8000, view=True, rebuild=False,
|
|||
confdir = find_confdir()
|
||||
conf = read_conf(confdir)
|
||||
|
||||
import SimpleHTTPServer
|
||||
import SocketServer
|
||||
try:
|
||||
import SimpleHTTPServer as server
|
||||
except ImportError:
|
||||
from http import server
|
||||
import socketserver
|
||||
else:
|
||||
import SocketServer as socketserver
|
||||
|
||||
import webbrowser
|
||||
|
||||
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
|
||||
httpd = SocketServer.TCPServer(("", port), Handler)
|
||||
Handler = server.SimpleHTTPRequestHandler
|
||||
httpd = socketserver.TCPServer(("", port), Handler)
|
||||
|
||||
ip, port = httpd.socket.getsockname()
|
||||
print("Serving HTTP on {}:{}.".format(ip, port))
|
||||
|
|
Loading…
Add table
Reference in a new issue