Is it possible to run program in python with additional HTTP server in infinite loop?
<p>I want to run program in infinite loop wich handles GPIO in raspberry PI and gets requests in infinite loop (as HTTP server). Is it possible? I tried Flask framework, but infinite loop waits for requests and then my program is executed. </p>

<p>If I were to face with a problem like this right now, I wold do this:</p>

<p>1) First I'd try figuring out if I can use the event loop of the web framework to execute the code communicating with raspberry-pi asynchronously (i.e. inside of the event handlers).</p>

<p>2) If I failed to find a web framework extensible enough to do what I need or if it turned out that the raspberry-pi part can't be done asynchronously (e.g. it is taking to long to execute), I would figure out what is the difference between threads and processes in python, which of the two can I use in my specific situation and what tools can help me with that.</p>

<p>This answer is as specific as the question (at the time of writting).</p>

python raspberry-pi