Install software:

opkg update 
opkg install python-openssl 
opkg install distribute 
easy_install bottle  
nano /mnt/sda1/pythonweb.py
#!/usr/bin/python
from bottle import route, run
@route('/hello')
def hello():
    return "Hello World!"
run(host='192.168.0.102', port=8080, debug=True)

Make sure use your Yun ip address to replace localhost.

chmod 755 /mnt/sda1/pythonweb.py
/mnt/sda1/pythonweb.py

Use Browser test "http://192.168.0.102:8080/hello"

change 

run(host='192.168.0.102', port=8080, debug=True)

to

run(host='0.0.0.0', port=8080, debug=True)

will make it listen to all the interface '192.168.0.102' ethernet port and '192.168.0.122' wifi plus '127.0.0.1' local host 

Run it as:

/mnt/sda1/pythonweb.py &

will make it running as back ground

 

 

Comments powered by CComment