JavaScript how to link to a .py file | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

JavaScript how to link to a .py file

I’ve recently been working with my Raspberry pi 3 and I’d like to know how to execute a certain script when let’s say I clicked a button on the website? How could I do that?

24th Dec 2017, 10:33 PM
Kenzoid
Kenzoid - avatar
1 ответ
0
You could do a couple of things. 1. Make a python program that hosts a webserver on a different port. Have the javascript response to the button press reach out and make a request to that python Web server which will run the python code for every request. 2. Make a python program that will be a cgi script and make your Web server know how to process python scripts like it knows how to process php or perl.
25th Dec 2017, 12:23 AM
Kevin Gilkey-Graham
Kevin Gilkey-Graham - avatar