JosefJezek
10/22/2013 - 1:54 PM

Python HTTP Server

Python HTTP Server

#!/bin/sh
# Python HTTP Server

PORT=8765

# Detect Python version
ret=`python -c 'import sys; print("%i" % (sys.hexversion<0x03000000))'`
if [ $ret -eq 0 ]; then
    # Python version is >= 3
    MODULE=http.server
else
    # Python version is < 3
    MODULE=SimpleHTTPServer
fi

# Python HTTP module serve the current directory to 0.0.0.0
python -m $MODULE $PORT > /dev/null 2>&1 &