3 ms·
On practically any linux (or mac) you can do $ python -m http.server 8080 to instantly start up a server in that directory. You can do this in multiple terminal
by the_pwner224 6y ago
On practically any linux (or mac) you can do $ python -m http.server 8080 to instantly start up a server in that directory. You can do this in multiple terminals to have multiple servers on different ports serving multiple directories. Nginx, Apache require significant configuration and reboot to apply changes. They're not at all comparable.
- sgc 6y agoApache usually just needs to reload the config file not reboot, and it's also often only a few lines to get whatever you want done. Reload might take 1/2 a second, but I doubt it takes even that long. Sure, if you want to load a module with a bunch of new functionality you might need the 2 seconds it takes to reboot unless you have thousands of sites, but that has been a rare experience in the last 7 years or so for me. If you have thousands of sites you are not using python server anyway. In the end apache config is relatively easy -- especially to just test stuff quickly --, it's the overall server security that is more nebulous due to the variety of attack vectors throughout the stack. I would guess all that is similar on Nginx. So sure, it is a little easier to just throw out a one liner, but it doesn't give you an environment that is similar to deploy, so the extra 2 minutes to open the apache config and reload is worth it to me for the implicit bug testing going on. Of course none of us has a horse in the race and to each his own on his own box. But it's fair to keep their names in the conversation at least.
- Joker_vD 6y agoThat comes really handy when you want to, say, transfer some files from your PC to your phone/tablet without uploading them somewhere else first.
- IgorPartola 6y agoHow is it more of a burden to install apache2 vs sinatra? “Significant configuration” required for a static web server with apache2 is limited to just a few lines of configuration specifying the directory you want to serve and on what port. Look, I love me an ad hoc HTTP server for development work, especially the one Python comes with, but calling it a one line web server is like calling “apt install postgres” a “one line database server”. It’a just not a one liner.