0

below was my uwsgi.ini file:

[uwsgi]
module = myblog.wsgi
#socket = 127.0.0.1:8000
chdir = /opt/python3/myblog
buffer-size = 32768
home = /root/.pyenv/versions/3.7.1/envs/blog/
env = DJANGO_SETTINGS_MODULE=myblog.settings
socket = /opt/python3/myblog/myblog.sock
pidfile2 = /var/run/uwsgi/uwsgi.pid
daemonize2 = /var/log/uwsgi/uwsgi.log
log-format = %(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"

process = 4
threads = 2
uid = 1000
gid = 1000
master = true

chmod-socket = 664
chown-socket = nginx:nginx

# clear envirnment to exit
vacuum = true

when I set the uid and gid, and I tried to start uwsgi, it abortd. The error info was below.

uWSGI running as root, you can use --uid/--gid/--chroot options
setgid() to 1000 setuid() to 1000 Python version: 3.7.1 (default, Dec
18 2018, 07:21:59)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] !!! Python
Home is not a directory: /root/.pyenv/versions/3.7.1/envs/blog/ !!!
Set PythonHome to /root/.pyenv/versions/3.7.1/envs/blog/ Fatal Python
error: initfsencoding: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fc575d01840 (most recent call first): Aborted

but if I only set the uid and annotate gid. It works fine. I don't know why. It's really make me confused.

fred
  • 13
  • 6
  • https://stackoverflow.com/questions/49144225/uwsgi-will-not-run-in-mixed-python-environment-in-order-to-operate-correctly-wit might be relevant – gold_cy Jan 17 '19 at 03:08
  • Is it possible that the user you are switching to (1000) does not have read access to the virtual environment created under `/root`? – Will Keeling Jan 17 '19 at 10:35

0 Answers0