下面是我的uwsgi.ini文件:
[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
当我设置uid和gid并尝试启动uwsgi时,它异常终止。错误信息如下。
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
但是如果我仅设置uid并注释gid。工作正常。我不知道为什么真的让我感到困惑。