Recently there was a small Web project that wanted to use Python as a favorite, but I felt a shudder at the thought of previous contact, why? Django's configuration is too complex, and small projects are not suitable for the MVC development model, so I look to web.py this small web framework, and really I am tempted to all of its official website is a word: "Django lets you write Web apps in Django. TurboGears lets you are write Web apps in TurboGears. web.py lets you write Web apps in Python. "-adam Atlas
Recently switched Ubuntu to replace the Win7 system, so here's a description of Ubuntu installed web.py
Install Easy_install
sudo apt-get install Python-pip
Use Easy_install to install web.py
Test whether the installation was successful:
Executing in the Python shell:
If there is no error, the web.py installation succeeds. Here we go, our first hello,world.
Import Web
urls = ("/.*", "Hello") # Specifies that any URL points
to the Hello class app = Web.application (URLs, Globals ()) # binding URL
# definition Corresponding class class
Hello:
def get (self): return
' Hello, world! '
if __name__ = = "__main__":
App.run ()
Then save it as hello.py and run it
Then you'll see the output: http://0.0.0.0:8080/
Then browser access: http://localhost:8080 can see Hello, world! The first Web program we wrote in Python was built.