flipkart

Saturday, November 1, 2014

Running python server current directory in Ubuntu

Today i am going to explain running python server in Ubuntu it is  for temporally purpose suppose normally for running server we need install some software like Apache or tomcat etc. But no need to install extra software and no much space extra in memory only one command is enough for running server for current directory.
   
         After opening terminal (Ctrl+Alt+terminal) once check python installed or not i think all most every Ubuntu python is inbuilt package so no need wary about installation of python if python is not there simply type following on your  terminal

$ sudo apt-get install python
                 
              or 
open synaptic manager search python package after install 


After successful installation of python open terminal type following command
before running command which you want run server go that directory cd command

$ python -m SimpleHTTPServer

After typing above command it will run python server on your host system if want cross check server is running or not  open any browser type following line tab.

http://localhost:8000/

Normally it will take default port number is 8000 if want change you can  on terminal following command

$python -m SimpleHTTPServer 8088

Now port number changed as your wish


No comments:

Post a Comment