S
S
Stanislav Somov2015-11-04 11:53:37
Serial port
Stanislav Somov, 2015-11-04 11:53:37

Working with hardware via the web in python?

There is a small console application that can exclusively query equipment on the com port. I want to attach a web face to it on flask. I tried to throw data from the hardware onto it, everything is fine in the request mode from one workplace (each request to the page makes a direct request to the device on the port). If you request data from different workplaces, then problems naturally arise, since each open page starts to break on the port. The question is what algorithm or intermediate structure to use (also in the future, graphs are needed, a database may be needed)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
cardinalus, 2015-11-04
@DarkDemon

If graphics are in the plans, then you can hardly do without a database.
Option:
- the application runs periodically (as convenient - scheduler, service, etc.) and writes data to the database
- WEB interface displays data not from the application but from the database
- if necessary, make a button on which you hang up a request for up-to-date data (sometimes it can come in handy).

N
nirvimel, 2015-11-04
@nirvimel

each page request makes a direct request to the device on the port

Pretty bad decision.
First, the web server and the hardware program must run in separate processes.
Secondly, for communication between processes, you can take something like pyzmq, and from the web server side, this must be done asynchronously, for example, using gevent + gevent-zeromq

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question