DEV Community

Cover image for Sharing folder and files with python http_server and ngrok to get an external url.
Vijay Daswani
Vijay Daswani

Posted on

Sharing folder and files with python http_server and ngrok to get an external url.

Python standard library comes with a in-built webserver which can be invoked for simple web client server communication. The port number can be assigned programmatically and the web server is accessed through this port. Though it is not a full featured web server which can parse many kinds of file, it can parse simple static html files and serve them by responding them with required response codes.

Make sure you have python installed on the machine.

Run below command, it will serve the current folder in web browser.

Go into a folder which you want to share.

if you have python 2.7 run below command.

python -m SimpleHTTPServer
Enter fullscreen mode Exit fullscreen mode

if you have python 3+ then try below command.

python3 -m http.server
Enter fullscreen mode Exit fullscreen mode

Output shown below.
image

And now the best part is to share it with other than localhost.
Install ngrok. https://ngrok.com/download

Once you have the ngrok.
run below command.

ngrok http 8000
Enter fullscreen mode Exit fullscreen mode

Output.
image

Paste local tunnel url/ forwarding url to the browser and url can be share with anyone and they can download the files from anywhere.

Thanks for reading. :)

Top comments (0)