uWSGI python致命Python错误:Py_Initialize:无法获取语言环境编码

时间:2017-09-09 13:38:37

标签: python django ubuntu nginx uwsgi

我正在尝试设置uWSGI nginx Django应用程序并在uwsgi日志中获取以下错误

Sat Sep  9 13:01:48 2017 - Python version: 3.5.2 (default, Nov 17 2016, 17:05:23)  [GCC 5.4.0 20160609]
Sat Sep  9 13:01:48 2017 - Set PythonHome to /home/ubuntu/.virtualenvs/app_name
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

我在virtualenv中使用python 3.6但是不确定为什么uwsgi使用python版本:3.5.2。这会导致错误吗?

我使用的uWSGI配置

[uwsgi]
# variables
project = app_name
username = ubuntu
base =  /home/%(username)/app_name

# config
chdir =  %(base)
home = /home/ubuntu/.virtualenvs/%(project)
module = %(project).wsgi:application

master = true
processes = 4

die-on-term = true
vacuum = true

socket = %(base)/%(project).sock
chmod-socket = 664

uid = ubuntu
guid = www-data

logto = /var/log/uwsgi/uwsgi.log
daemonize = /var/log/uwsgi/emperor.log

env = DJANGO_SETTINGS_MODULE=settings.dev

我正在使用Ubuntu 16.04,默认的python3版本是 3.5.2 ,我在uWSGI conf中提供的virtualenv路径是 3.6.2 但python版本uWSGI使用的似乎是 3.5.2

0 个答案:

没有答案