T
T
ThemeZV2014-12-01 19:54:01
Django
ThemeZV, 2014-12-01 19:54:01

How to allow Django to use lpt port? How to implement a management program?

It is necessary to implement lpt port control from a web page. To control the lpt port, I use the pyParallel library. For web - Django.
How I see all this (Maybe there are more "correct" solutions?):
There are 8 buttons on the page, each is responsible for its own port pin. When one of the buttons is clicked, the number of the pressed button is passed (for example 3), Django takes the code (3) into a function that inverts bit (3) of the port.
As far as I understand, you can create 8 pages, upon transition to which a function will be launched that inverts the bit that corresponds to the page. But this is somehow wrong, in my opinion.
1. How to implement it correctly? If, for example, JS, then what exactly to use?
2. Superuser rights are required to manage the port, how can I allow python (django) to work with the lpt port?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2014-12-01
@gbg

On the third point - you need to either give the user permissions on / dev / lp0, or, if the python library communicates with the port by registers, write a small layer that, working under the superuser, will give access to the port and have an interface, for example, in the form of a socket .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question