To run http.server
, you are first going to want to become familiar using the Mac OS X terminal. The terminal provides "shell" access to your computer. You can browse directories and execute applications via text-based commands. You can find the Terminal app in Applications->Utilities->Terminal. Run it and you'll see something like.
The blinking cursor is the "prompt", where you can execute a command. Here is a list of some common commands you'll need.
cd
- change directory. The following, for example, will set the current path to your desktop. You'll want to replace "shiffman" with your username. cd /Users/shiffman/Desktop
.pwd
- print working directory. This will print out the current directory.ls
- list the contents of the current directory.This is barely scratching the surface of what you can do with unix commands. Allison Parrish's class also has a tutorial about using unix commands to manipulate text data. But we'll stop here, after all, we're just here to run a simple web server.
Your job is to get terminal to point to the directory on your computer where you are storing your p5.js work. On my computer I've got a ton of examples in a directory called "The-Nature-of-Code-Examples-p5.js". So I'm going to browse to it by doing the following.
$ cd /Users/shiffman/Documents/noc/The-Nature-of-Code-Examples-p5
(You don't need to type the '$' I'm just using it to represent a prompt.)
Once I'm there, I can start up a web server with the following command.
I should then see:
Serving HTTP on 0.0.0.0 port 8000 ...
This means the server is up and running at localhost on port 8000. And this means I can type http://localhost:8000/
into the address of a web browser and I'll see:
TAB
.Before you can run a local server on windows with python, you'll need follow a few steps.
You'll need a console application that lets you interact with Git and your computer in much the same way as the Terminal application on Apple computers. There are several options.
Install Git Bash
use all the default settings.
When you get to the Adjusting your PATH environment
screen, be sure to choose the option for Use Git Bash Only
.
You should have now have a program in your Start Menu called Git Bash. If you hit the Windows key to pull up the start menu and type “git bash” you should see the program highlighted.
You will now need to make sure that Git Bash recognizes python. You can do this temporarily with this command in Git Bash: PATH=$PATH:/c/Python36/
(or whatever version of python you are running). However if you want this to be permanent you'll need to add c:\python36
to your system environment variable path
. Here is how you access that..
An alternative to Git Bash is the windows built-in command prompt. This should work but you'll have to use DOS versions of the unix commands I'm showing in class.
An alternative to all of this is WAMPServer.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4