I tried to make an app with Django and finally publish it
sudo /usr/local/bin/uwsgi --ini myapp_uwsgi.ini --uid nginx --gid nginx
If you hit the command
Set PythonHome to /home/uesrname/.virtualenvs/virtualenvname
ImportError: No module named site
I get an error and it doesn't work. What a mess.
myapp_uwsgi.ini looks like this
myapp_uwsgi.ini
# myapp_uwsgi.ini file
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /var/www/myapp
# Django's wsgi file
module = myapp.wsgi
# the virtualenv (full path)
#home = /usr/local/bin/virtualenv
home = /home/username/.virtualenvs/virtualenvname
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = /tmp/myapp.sock
# ... with appropriate permissions - may be needed
chmod-socket = 666
# clear environment on exit
vacuum = true
By the way, without sudo
/usr/local/bin/uwsgi --ini myapp_uwsgi.ini --uid nginx --gid nginx
If so, it worked without problems, so the mystery just deepened. By the way, the OS is CentOS 6.9.
It seemed to be a permissions issue and it worked when I changed the permissions on / home / username from 700 to 755. I'm not sure why it doesn't work even though it's sudo. Is it a linux kernel permission or credential issue?
The same error, No module named site, seems to have various symptoms, so I couldn't find a pinpoint solution. If it helps someone.
Recommended Posts