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

2 1

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. :)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay