Search code examples
pythondjangoubuntupermissionsserial-port

Let Django access serial port in Lubuntu


So, I need my Django to access the serial port

I'm correctly using it via pyserial package the issue is that, every time I boot the OS I got the error of Access denied.

The only way to make it work is to grant access to the specific serial for everyone via sudo chmod 666 /dev/ttyUSB0

Is there a way to let Django access the serial anyway, instead of let eveyone access it with 666?


Solution

  • So it turned out you need to add the User that manages Django deployment and execution to the dialout group with

    sudo usermod -a -G dialout $USER
    

    Restart or logout, login to see it work