Eddymens (List page)

Last updated 2023-08-23 04:42:02

How To Start An HTTP Server In Python 2 & 3

Table of contents

Python provides a convenient way to start a simple HTTP server to serve up HTML files using the SimpleHTTPServer module in Python 2. In Python 3 this is done using the http. server module.

Starting a server in Python 2

01: python -m SimpleHTTPServer 8000

Starting a server in Python 3

01: python -m http.server 8000

If you have both versions of Python install Python 3 might be available as `python3`` in which case use the line below instead.

01: python3 -m http.server 8000

Renaming Python 3 to Python

$ alias python=python3

Here is another article you might like 😊 "A row must be an array or a TableSeparator instance | Laravel artisan fix"