Quick Tip – Starting a Local Web Server with Python

I’ve been doing some web development lately, and came across a great little tip about how to quickly run a local web server. This is especially useful if you’ve ever run into problems with restrictions in executing local javascript files in a browser.

If you have Python installed on your computer, type the following command in your website project directory, to initialize a local web server.

  • python -m SimpleHTTPServer 8888 & (Python v. 2.x) or python -m http.server 8888 & (Python v. 3.x)
  • Then open up a browser and go to the URL http://localhost:8888 and view the website.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s