Yesterday i got to know a new friend called CherryPy, a lovely sweet lady? No, it’s a “minimalist Python Web Framework”. Someone replied to my forum topic and he explained quite a lot about web application.
CherryPy seems to be a good alternative to web2py although she is older.
1. So, let’s start off by installing CherryPy in our RaspberryPi by downloading the tar.gz file from here.
UPDATE: can just install using
sudo pip install CherryPy
2. Save it in your home/pi directory and open up the LXTerminal.
tar -xzvf CherryPy-3.2.2.tar.gz
4. Rename the file to CherryPy for ease of access
5. Then go to the directory created by the file extraction
6. Type: (user has to be root)
sudo python setup.py install
7. Run the first sample website by going to cherry/tutorial directory and type “python tut01_helloworld.py”
There you go, Hello World! 🙂
To stop the server, press
** create a new “shutdown” function using “cherry.engine.exit()” and display it as a link on the web app – when clicking that shutdown link, the server will shutdown and the port will be freed. 😉
Now i will download the file from the forum and see what he has got for me!
1. Go back to the home directory (where you have saved the zip file)
2. Then create a new folder named mobile_website (or something else of your choice)
3. Move the extracted files into the folder.
4. Go to that folder direcotry in terminal, type:
(it is also possible to edit the file directly using IDLE or other editors)
5. Add in
#!/usr/bin/python at the top of the page
6. Edit the tutorial.conf
Change tools.staticdir.root =”/home/pi/mobile_website”
6. Run python remote_control.py to start the server or double click on the remote_control.py
(Ok, it doesn’t work on my R-Pi)
ChannelFailures: IOError (“Port 80 not free on ‘0.0.0.0’”)
Stuck and waiting for someone to help me in the forum. 😦