Вопрос

I have a django-based website. And I have an RFID-reader used by the django site. The reader's have a monitor, and a function, wich gives back the uid of the inserted card. When card isn't inserted, it gives back None.

I'd like to "run" the monitor's code while the django site is running, and I'd like to call the function of the monitor from my views, to use the uid of the rfid. How can I do this?

Thanks!

Это было полезно?

Решение

Well, there are many ways to do this. One would be a simple daemon (card observer) script that reads the card data every second or so and puts it in a memcached/db/file. Then you simply read it in the view.

Once you get this working, you may want to take another course, like running a observer thread from Django etc.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top