"Hello World" Vanilla : Python with Bottle framework


=> Python is programming language and it's unique look as follow
  • Readable
  • Garbage collection handled 
  • Scripting language
  • Dynamic typing 
  • Easy to code and faster development 
  • ....
http://www.python.org/

=> Bottle is Python's well known Web Framework and it's unite thing as follow
  • Faster
  • Simple
  • Lightweight
  • ...
http://bottlepy.org/docs/dev/

My Simple "Hello World" example with Python Web framework bottle

# include bottle web framework
import bottle 
# create root url route 
@bottle.route('/')
#create function name home_page 
def home_page():
    return "Hello WorldHello World"


#create route url "/testpage" 
@bottle.route('/testpage')
def test_page():
    return "this is the test page"

#Enable the bottle in debug mode 
bottle.debug(True)

#listening the server. define host name and port no   
bottle.run(host='localhost',port=8080)

Help me, How can i run above simple code ?
Run it in python console and fire below URL in your favorite browser and experience result :)

1) http://localhost:8080/
Output : Hello World in html form.
2)http://localhost:8080/testpage
Output : "this is the test page" in text form.

Thanks for exploring this post and learn the python language ..
Do coding and explore language ...

Bye ..take care and have nice weekend ..
[Fri 29 Nov 2013][20:08:06]

Comments

Popular posts from this blog

Simple way producer–consumer problem's implementation in NodeJs

Step by step guide on how to pay Income Tax that is due

Cassandra Materialized view vs Index