DEV Community

Alexander Alemayhu
Alexander Alemayhu

Posted on

5 2

Easy way to start a web server

You can always use a bundler in development mode but sometimes you just want a simple HTTP server with basic security and isolated 😉 My favorite tool for that is python. On macOS and Ubuntu, it's installed by default so no setup is usually required.

This works well because Python ships with an HTTP module in the standard library so it's straightforward to start a server:

$ python -m http.server 2020
Serving HTTP on 0.0.0.0 port 2020 (http://0.0.0.0:2020/) ...
Enter fullscreen mode Exit fullscreen mode

Or if you are still using python2

$ python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...
Enter fullscreen mode Exit fullscreen mode

In most cases, the above is enough but in rare cases, you want to bind explicitly to an address:

python -m http.server 2020 --bind 192.168.0.6 

Serving HTTP on 192.168.0.6 port 2020 (http://192.168.0.6:2020/) ...
Enter fullscreen mode Exit fullscreen mode

Thanks for reading.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more