3

I'm trying to setup uWSGI nginx Django application and get the below error in uwsgi logs

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'

I'm using python 3.6 in virtualenv however not sure why uwsgi uses python version: 3.5.2. Will this be causing the error?

uWSGI config that I have used

[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

I'm using Ubuntu 16.04 where the default python3 version is 3.5.2, virtualenv path that I have given in uWSGI conf is 3.6.2 but the python version used by uWSGI seems to be 3.5.2

Gowtham
  • 115
  • 2
  • 9

0 Answers0