标签:pthread start pat most this ldo lin col loaded
uwsgi uwsgi.ini
启动报错
ini文件中切换用户nginx后,因为权限问题,python虚拟环境变成了系统默认环境,缺少很多库。
另外切换用户启动,可能没有旧sock文件的权限,导致socket绑定失败。应删除旧socket。
(flask) [root@localhost flask]# uwsgi uwsgi.ini [uWSGI] getting INI configuration from uwsgi.ini *** Starting uWSGI 2.0.17.1 (64bit) on [Sun Oct 21 03:50:21 2018] *** compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-28) on 20 October 2018 12:54:58 os: Linux-3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 nodename: localhost.localdomain machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 2 current working directory: /var/flask detected binary path: /root/.local/share/virtualenvs/flask-VGoRTHto/bin/uwsgi setgid() to 995 setuid() to 997 chdir() to /var/flask/ *** WARNING: you are running uWSGI without its master process manager *** your processes number limit is 3802 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to UNIX address /var/flask/flask.sock fd 3 Python version: 3.4.9 (default, Aug 14 2018, 21:28:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] !!! Python Home is not a directory: /root/.local/share/virtualenvs/flask-VGoRTHto/ !!! Set PythonHome to /root/.local/share/virtualenvs/flask-VGoRTHto/ Fatal Python error: Py_Initialize: Unable to get the locale encoding ImportError: No module named ‘encodings‘ Current thread 0x00007f03d1f7e840 (most recent call first): 已放弃
[uwsgi] # Http access port. # If this option comes into effect, we can visit our web site on http://[our IP]:[Port] # http=:5001 # Uwsgi‘s ip and port when it is loaded by Nginx socket=/var/flask/flask.sock chmod-socket=666 uid = nginx gid = nginx # Point to the main directory of the Web Site chdir=/var/flask/ # Setting up a virtual environment virtualenv=/root/.local/share/virtualenvs/flask-VGoRTHto/ # Python startup file wsgi-file=app.py # The application variable of Python Flask Core Oject callable=app # The maximum numbers of Processes processes=1 # The maximum numbers of Threads threads=2
虚拟环境下:
uwsgi -s /var/flask/flask.sock -w app:app
chmod 777 /var/flask.sock
启动正常
uwsgi部署相关问题Fatal Python error: Py_Initialize: Unable to get the locale encoding
标签:pthread start pat most this ldo lin col loaded
原文地址:https://www.cnblogs.com/eledim/p/9824552.html