dl8
dl8

Reputation: 1270

Error when starting Gunicorn as nobody

So when I run the command

gunicorn test.wsgi:application --bind 127.0.0.1:8000 --workers=3 --user=nobody

I get the error:

OSError: [Errno 1] Operation not permitted: '/tmp/wgunicorn-QGaR6q'

Which seems like I'm not allowed to start the process as another user, so when I try the same command with sudo, I get a bunch of errors dealing with:

ImportError: No module named django.core.wsgi

and

raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

I'm doing all this in a virtual environment so I'm thinking it has to do with it not recognizing it when I'm in sudo, but without sudo I don't have the permissions to start the server as another user.

Upvotes: 2

Views: 1734

Answers (2)

Meelan Lakhoo
Meelan Lakhoo

Reputation: 11

In order to sort out the Import error (ImportError: No module named django.core.wsgi)

make sure that you have installed django in your virtualenv

To install django in the virtualenv enter the following commands: cd <virtualenvdirectory> , source bin/activate and pip install django

Upvotes: 0

zac
zac

Reputation: 69

I had this same issue if you edit your supervisor's app conf or run the command without the --user flag it works. I am also working with a digital ocean droplet and have not been able to get supervisor working with the user flag.

Upvotes: 3

Related Questions