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