5 ms·
python -m SimpleHTTPServer
by dylz 13y ago
python -m SimpleHTTPServer
- pekk 13y agoalthough that server is very horrible
- hcarvalhoalves 13y agoWorks fine for some tests, but it's single threaded. If you need concurrency: twistd -no web --path=.
- stock_toaster 13y agoor in go: package main import ( "flag" "net/http" ) var serveDir = flag.String("d", ".", "Directory to serve from") func main() { flag.Parse() panic(http.ListenAndServe("127.0.0.1:8000", http.FileServer( http.Dir(*serveDir)))) }
- deathanatos 13y agoPerhaps, but the use case it usually finds is "I need a webserver, here. Now." Python is nearly always installed, and that depends on nothing but the standard library. You can stick an alias in your dotfiles (I have, it's called "serve-this") and not have to worry about having twisted¹ getting to wherever your dotfiles get put. (I distribute my dotfiles over git/github, so it's really easy to move them around. More work to get Twisted.) ¹Or Ruby… or Go…
- hcarvalhoalves 13y agoTwisted is pre-installed on OS X and various Linux distributions...
- Orangeair 13y agoWhat's wrong with it? Honestly, I don't know. I know Python probably isn't a great choice for performance reasons, but anything else? It's super easy to build off and configure. Seems fine for a beginner (which I admittedly am; hence my asking).
- masklinn 13y agoMain issue is it's single threaded. So if you use it to share big files with an other machines, only 1 file can be downloaded at a time and a download will block browsing of available files.
- lucian1900 13y agoIt's also very buggy. Its only excuse is being old.
- eik3_de 13y agothe minimal Ruby equivalent would be ruby -run -ehttpd . Here's a handy snippet for bashrc: function S { ruby -run -ehttpd . -p${1-8080} # default to port 8080 unless given as parameter }