Hi,
A newbie to Python.
So basically, what I am trying to achieve here is, I have a web server (apache) on raspberry pi zero. Web pages has buttons and when the button are pressed a AJAX GET call is made to a XML file with parameters. Example - bcast.xml?mode=0 or bcast.xml?mode=1 or bcast.xml
Now there is no such file called bcast.xml
I am trying to develop an Python script which will be constantly looking for bcast.xml request from Apache and when the request is made, it performs some function and return data for that GET request.
I have no clue where to start and with some Googling and Stackoverflow, I was told to make use of Flask and WSGI and I made this
And when I load localhost and try clicking the buttons, the console say - 404 no file
Basically, the Python program should constantly look for that request and respond to it
How to do it, its a kind request. Please provide me directions or examples on how it has been done, as I am in a total lost here.
Also please let me know, what are the changes I should implement in Apache to make this work
Thanks in Advance
A newbie to Python.
So basically, what I am trying to achieve here is, I have a web server (apache) on raspberry pi zero. Web pages has buttons and when the button are pressed a AJAX GET call is made to a XML file with parameters. Example - bcast.xml?mode=0 or bcast.xml?mode=1 or bcast.xml
Now there is no such file called bcast.xml
I am trying to develop an Python script which will be constantly looking for bcast.xml request from Apache and when the request is made, it performs some function and return data for that GET request.
I have no clue where to start and with some Googling and Stackoverflow, I was told to make use of Flask and WSGI and I made this
from flask import Flask, request app = Flask(__name__) @app.route("/bcast.xml", methods=["GET"]) def bcast(): mode = request.args.get('mode',default = 0, type = int) print mode app.run()When executed, it says Server started in 127.0.0.1 with Port 5000
And when I load localhost and try clicking the buttons, the console say - 404 no file
Basically, the Python program should constantly look for that request and respond to it
How to do it, its a kind request. Please provide me directions or examples on how it has been done, as I am in a total lost here.
Also please let me know, what are the changes I should implement in Apache to make this work
Thanks in Advance