You will want to invoke the HTTP server from the directory you consider to be the document root. Supposing your project folder is /home/tyler/project1 you can change directories like this:
If your project is in your home directory you could also use this command:
You can invoke the simple HTTP server with the -m flag like this:
python -m SimpleHTTPServer
This will automatically use your current directory as the document root. It will server files in the current directory and below. It directly maps the HTTP requests to the directory structure.
When you start the server you should see something like this:
Serving HTTP on 0.0.0.0 port 8000 ...
By default, this command will start the HTTP server on port 8000 and bind to any available IP (signified by 0.0.0.0). In most cases, you'll be able to make requests to http://localhost:8000 in order to use the server.
If you want to use a port other than 8000, you can do so by specifying the port at the end of the same command:
python -m SimpleHTTPServer 8080
Keep in mind that if you specify a port lower than 1024 (like port 80), you will have to use root:
sudo python -m SimpleHTTPServer 80
You can visit your site in a web browser by typing the following in the url bar: