Skip to content

Instantly share code, notes, and snippets.

@mapio mapio/
Created Apr 17, 2015

What would you like to do?
A small script to serve a local directory via HTTP
# see
trap 'kill -TERM $PID' TERM INT
python -m SimpleHTTPServer & PID=$!
python -m webbrowser -t ""
wait $PID
trap - TERM INT
wait $PID
exit $?

This comment has been minimized.

Copy link
Owner Author

mapio commented Apr 17, 2015

Just go to the directory you want to serve and type (if you have it in your path, or ./ if you have saved it in the directory are into). It will start the Python SimpleHTTPServer from the current directory and open the system web browser pointing it to the just started server; once done, hit ctrl-c and it will stop the running server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.