8 ms·
If in need of serving current dir over HTTP I use python -m SimpleHTTPServer works everywhere I need it to work. Anyway, kudos for making a Go project sh
by zytek 11y ago
If in need of serving current dir over HTTP I use
python -m SimpleHTTPServer
works everywhere I need it to work.
Anyway, kudos for making a Go project shipped, which I fail to accomplish for several months now ;-)
- jackyb 11y agoI don't know why but it often takes a really long time for me to reload the web page using Python 2 and 3 on Linux. Anybody has similar experience?
- jeffreyparker 11y agoIt can only serve one connection at a time, so if you're using it to serve a file download or have multiple users accessing it simultaneously it'll hang for all other clients.
- skywhopper 11y agoThe Go server is likely faster, and it's certainly faster to type "ran" than "python -m SimpleHTTPServer".
- masklinn 11y ago> The Go server is likely faster Which is not usually relevant if you just want to share a file over local HTTP. If you need a production-level HTTP server, you're not using either. > it's certainly faster to type "ran" than "python -m SimpleHTTPServer". If you're smart enough to compile ran and put it on your PATH, you're probably smart enough to create an alias for `python -m SimpleHTTPServer`.
- junke 11y ago> ... faster ... faster It is faster to use an existing tool (python or another one) than rewriting a 2K LOC one. This is great for learning Go but the compounded time "lost" with a "slow" python server is nothing compared to the time this tool will require in development, debugging and maintenance over the years. As anyone else, I am subject to NIH and I can understand why writing one's own library is interesting by itself. Please don't invent weak excuses like "ran is faster to type".
- shazow 11y agoI love SimpleHTTPServer. I use it 80% of the time. One downside is that it's single-threaded, so if you have multiple people who need to fetch stuff from your server it can get pretty painful. I was helping run a programming workshop last week and I wrote my own tiny concurrent server in Go but in the future I think I'll just use Caddy (https://github.com/mholt/caddy https://github.com/mholt/caddy).
- saintfiends 11y agoFor python 3 python -m http.server