質問

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