Monday, April 14, 2014

[Python] Hosting static web pages locally on mac

Looks like I can simulate a simple FTP server locally without setting up an actual FTP or web server when development static websites. 

On your terminal, navigate to the directory of your project and start this:
$python -m SimpleHTTPServer

 And when this is printed: 
Serving HTTP on port 8000 ...

Open localhost:8000 in browser and you should able to see your index.html rendering!

This is very handly to test out all file path of static files and simulate a FTP server locally. I can finally skip my skeleton.js node server :)

Have fun coding!