Skip to content

Instantly share code, notes, and snippets.

@andyinabox
Forked from daytona1/local_server.md
Created January 31, 2017 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyinabox/ff8efb23b8d1c85165e6988c5df247a1 to your computer and use it in GitHub Desktop.
Save andyinabox/ff8efb23b8d1c85165e6988c5df247a1 to your computer and use it in GitHub Desktop.
Running a local server

Running a Local Server

This document includes instructions on how to run a local server on your computer using Python.

Python setup

You may need to run a local server for all of the features of p5 to work. On a Mac, you should already have Python installed which has an easy built-in way to start up a server from your project. Open up your terminal and try this:

 $ python --version

If python is installed you should see something like Python 2.7.8 (you may have a different version installed). If you get an error you may need to download and install Python (you will want to install version 2.x.x, not 3.x.x).

Run the server

Once you're sure that you have Python, go to your project folder:

 $ cd [path to your project]

(Hint: an easy way to do this is type cd and add a space, then drag your project folder into the Terminal window, then hit return)

Terminal drag trick

Once you're there, try this command:

python -m SimpleHTTPServer

If it worked, you should see something like this:

Serving HTTP on 0.0.0.0 port 8000 ...

python server

Now you have a server running on your computer! Go to http://localhost:8000/ to check it out!

Stopping the server

You can stop the server by either:

  1. Closing the terminal window
  2. Typing control+C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment