Phython web server

May 10, 2016

python
webserver
web development

If you are on linux / OSX or inside a phyton environment you can start a web server simply calling an alias from the terminal in your project folder.

Edit your bash profile and add the following line:

alias server='open http://localhost:8000 && python -m SimpleHTTPServer'

This feature is very useful when you are working in local host with a browser that disables by default the origin load (i.e. Chrome).

after inserted the alias inside the.bash_profile, refresh with the following command

source ~/.bash_profile

or restart you terminal. Now in the path of your project typeserverto open the web server.


Written by huckbit web developer who lives and works in UK building cool things. You can find me on twitter.