This is my gunicorn config file, with username specification:
$ cat /etc/gunicorn.d/wsgi.work
CONFIG = {
'working_dir': '/home/ubuntu/workdir',
'user' : 'ubuntu',
'group' : 'ubuntu',
'args': (
'--debug',
'--bind=0.0.0.0:5000',
'--workers=16',
'--timeout=60',
'wsgi:app',
),
}
$ sudo service gunicorn restart
I have this error :
SerialException: could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
Ubuntu user is the dialout group, so he have acces to /dev/ttyUSB0
Gunicorn run with ubuntu username:
$ ps aux | grep gunicorn
ubuntu 2586 0.0 0.5 18024 10824 ? S 08:54 0:00 /usr/bin/python /usr/bin/gunicorn --pid /var/run/gunicorn/wsgi.work.pid --name wsgi.work --user ubuntu --group ubuntu --daemon --log-file /var/log/gunicorn/wsgi.work.log --debug --bind=0.0.0.0:5000 --workers=16 --timeout=60 wsgi:app
And I have check in python code to display username, and it's ok. But running from command line work:
gunicorn --debug --bind 0.0.0.0:5000 wsgi:app
On Ubuntu 14 Arm Jetson TK1