0
(0)
SimpleHTTPServer – HTTPServer python CLI
¿Que es HTTP server?
De manera escueta y sencilla, HTTP server es un proceso que corre e una “máquina” que atiende peticiones de clientes y proporciona páginas web.Como ejemplo, al escribir en tu navegador https://nomadaenaustralia.com, un servidor en internet recibe esa petición. Como respuesta, envia datos que hacen que tu navegador reconstruya la página LandingPage de nomadaenasutralia.com.Esto es de manera muy escueta, naturalmente hay mucho más detras.Poniendo en funcionamiento un HTTP server
- Instalar Python-
- Abrir un terminal y comprobar la versión instalada, para ello ejecuta
python -V
- Ejecuta el siguiente comando para arrancar el HTTP server:
# If python -V returned 2.X.X
python -m SimpleHTTPServer
# If python -V returned 3.X.X
python3 -m http.server
Estos comandos parecen similares, y básicamente obedece su diferencia a la versión de python instalada en nuestra máquina:
SimpleHTTPServer fue "desarrollado" como http.server en la version Python 3
Al ejecutar el comando, obtendremos:
~$ python3 -V
Python 3.9.2
dietpi@odroidc2:~$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Para elegir un puerto diferente al 8000, ejecuta
$python3 -m http.server 9000
Con tu navegador en http://localhost:8000 o 9000 podrás ver un listado del directorio desde donde se ha lanzado el comando. Manten en mente que este servidor es a efectos de test y/o compartir archivos de manera local.
How useful was this post?
Thank you for reading this post, don't forget to subscribe!
Click on a star to rate it!
Average rating 0 / 5. Vote count: 0
No votes so far! Be the first to rate this post.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?
0 - 0
Thank You For Your Vote!
Sorry You have Already Voted!