DEV Community

Cover image for Use one Python terminal command to start a quick local HTTP server on your OS X machine πŸ’»
Richard
Richard

Posted on

1

Use one Python terminal command to start a quick local HTTP server on your OS X machine πŸ’»

I found myself wanting to dump some PDFs on my Kobo Forma ebook reader. But I didn't feel like digging out my USB-C to USB-A adapter so I could plug in the cable and use Calibre to transfer the books.

Hmm... well, the reader does have a rudimentary browser... I wonder if I could just download the books via HTTP or FTP on my wireless LAN?

So I found a way to do it.

First, fire up terminal and navigate to the directory that contains the files you want to serve.

Then run python -m SimpleHTTPServer 8000 and Bob's your Uncle.

terminal screenshot 1

(I found sudo apachectl start as well, which runs an apache server, but I like the python thing better.)

P.S. You can CMD-N to open a second terminal window, then use the command ifconfig en0 inet to get the IP of your server.

terminal screenshot 2

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay