Install the Python web. py framework and start programming from hello world, pythonweb. py
Recently there was a small web project that wanted to use python as a favorite, but I felt chilling when I thought that I had been familiar with django before. Why? The configuration of Django is too complex and small projects are not suitable for the MVC development mode, so I turn to the web. py is a small web framework, and it makes me feel like it is a word on its official website: "Django lets you write web apps in Django. turboGears lets you write web apps in TurboGears. web. py lets you write web apps in Python. "-Adam Atlas
I recently switched to Ubuntu and replaced Windows 7. So here we will introduce how to install web. py on Ubuntu.
Install easy_install
sudo apt-get install python-pip
Install web. py with easy_install
sudo easy_install web.py
Test whether the installation is successful:
Run the following command in python shell:
import web
If no error is reported, web. py is successfully installed. The first hello, world
Import weburls = ("/. * "," hello ") # specify that any url points to the hello class app = web. application (urls, globals () # bind a url # define the class hello: def GET (self): return 'hello, world! 'If _ name _ = "_ main _": app. run ()
Save it as hello. py and run it.
python hello.py
The output is http: // 0.0.0.0: 8080/
Then visit: http: // localhost: 8080 in the browser to see Hello, world! We established the first web program written in python.