spbach1234
Posts: 3
Joined: Sun Feb 21, 2016 12:55 pm

Python CGI Script

Sun Feb 21, 2016 1:00 pm

Hello, I am trying to make a webserver on the raspberry pi, that when you press a key on the keyboard, the webpage toggles a boolean in the script. However, I am stumped on what to do. I am using lighthttpd for the server.

Thanks,
-Spbach

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: Python CGI Script

Sun Feb 21, 2016 2:40 pm

Last edited by elatllat on Mon Feb 22, 2016 1:06 pm, edited 1 time in total.
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

spbach1234
Posts: 3
Joined: Sun Feb 21, 2016 12:55 pm

Re: Python CGI Script

Sun Feb 21, 2016 5:42 pm

Huh? how do I find that out?

mysen
Posts: 13
Joined: Sun Feb 21, 2016 11:49 pm

Re: Python CGI Script

Mon Feb 22, 2016 12:08 am

i believe that was a suggestion...

i'm not sure about lighthttpd but, with apache2 you can put your python code in the cgi-bin and have it out put the html with ajax with in it. it's a bit tricky to get going but simple once you understand it.

It all starter here: http://www.google.co.uk/

good luck!

dddomodossola
Posts: 42
Joined: Thu Jan 22, 2015 8:56 am

Re: Python CGI Script

Mon Feb 22, 2016 6:02 am

Maybe you can use REMI (RemoteInterface) https://github.com/dddomodossola/remi

With this library you can create webinterfaces for your scripts, and you don't need to install webservers or something else because it's all integrated.

spbach1234
Posts: 3
Joined: Sun Feb 21, 2016 12:55 pm

Re: Python CGI Script

Tue Feb 23, 2016 12:20 pm

mysen wrote:i believe that was a suggestion...

i'm not sure about lighthttpd but, with apache2 you can put your python code in the cgi-bin and have it out put the html with ajax with in it. it's a bit tricky to get going but simple once you understand it.

It all starter here: http://www.google.co.uk/

good luck!
I think the link you put is broken, can you repost it?
Thanks

ghans
Posts: 7867
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Python CGI Script

Tue Feb 23, 2016 12:50 pm

I would suggest using Remi too - it seems to take care of all that AJAX business so you can concentrate on your main logic.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

Return to “Python”