$ alias server='open http://localhost:1337 && python -m SimpleHTTPServer 1337'  
$ cd //Enter your Directory here 
$ server

On the Fly Local OS X Server with Python

So simple,  yet so powerful. Declare a local server in a directory and open in on the fly with this command. Simply use the code above to declare an alias to the command “server” and then open Terminal and change to the directory you want. Then start your server with that directory by typing server the following at the prompt:

Oh, and another thing. That alias command only applies to the current terminal session, so if you close terminal, that server command is dead. If you want to keep that server command around for all times, do the following, edit your bash profile by entering nano ~/.bash_profile and then adding the line alias server='open http://localhost:1337 && python -m SimpleHTTPServer 1337' and saving it.

Thanks, Anthony Garand for the tip. * P.S. You don’t type the “$”, silly.