2

I'm trying to create a control system that will run on a Raspberry PI configured as a server. I'll have a python program running on the server that will control a process (i.e. temperature).

My question is how would I go about communicating the the running python program via a web browser? I'd like to be able to set a control point and get back the current process value.

I'm new to web development and have been looking at PHP and CGI, but that doesn't feel right to me. Someone also suggested communicating via SQL, where a script and the python program would both have access, but this doesn't feel right either?

What is the preferred method for doing this?

Thanks

2

1 Answer 1

2

The easiest thing would be install Flask:

from flask import Flask
app = Flask(__name__)

@app.route("/")
def main():
    return "Hey cool, it works!"

if __name__ == "__main__":
    app.run("0.0.0.0", port=80, debug=True) # Might have to run as sudo for port 80
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.