Hardware Reference
In-Depth Information
5.
When everything is put together, the following code is what we'll see:
import web
urls = ('/','index')
class index:
def GET(self):
return "Hello world!"
if __name__ == '__main__':
app = web.application(urls,globals())
app.run()
6. We should be able to start the web page by execuing the Python script:
python helloworld.py
We should be able to launch the website from the IP address of the Raspberry Pi. For example,
if the IP address is 10.0.0.10 , the web page can be accessed at http://10.0.0.10:8080
and it displays the text Hello world . Yay!
A Hello world! example using the web.py framework
Objective complete - mission debriefing
We built a simple web page to display the Hello world text. In the next task, we will be
interfacing the Christmas tree and other decoraive appliances to our web page so that
we can control it from anywhere on the local network.
It is possible to change the default port number for the web page access by launching the
Python script as follows:
python helloworld.py 1234
Now, the web page can be accessed at http://<IP_Address_of_the_Pi>:1234 .
 
Search WWH ::




Custom Search