Kavvya Ramarathnam
Kavvya Ramarathnam

Reputation: 95

fatal python error :py_Initialize : unable to get the locale encodings import error: no module named encodings

the important part of the error message: I am getting the following error starting uWSGI 2.0.18 setting pythonHome to /var/www/demo/venv python version :3.5.3 Fatal Python error :unable to get the locale encoding import error : no module named 'encodings' It shows python version :3.5.3 however inside my venv/lib folder , there is only one package python 2.7 does this have something to do with my error?

please help me out with this.

this is my demo_uwsgi.ini file

#application's base folder
base = /var/www/demo

#python module to import
app = flaskfile     //flaskfile is my flask file
module = %(app)

home = %(base)/venv
pythonpath = %(base)

#socket file's location
socket = /var/www/demo/%n.sock

#permissions for the socket file
chmod-socket    = 666

#the variable that holds a flask application inside the module imported at line #6
callable = app

#location of log files
logto = /var/log/uwsgi/%n.log```

Am I missing plugins or something? I added plugins = python32 in my demo_uwsgi.ini file and it shows no such file or directory. Do I need to change or unset python path or something?

Upvotes: 0

Views: 505

Answers (1)

Kavvya Ramarathnam
Kavvya Ramarathnam

Reputation: 95

figured it out myself. Delete the default Nginx configuration file and add your new configuration file at the /etc/nginx. Then follow the instructions in this link https://vladikk.com/20.13/09/12/serving-flask-with-nginx-on-ubuntu/ step by step. change the ownership from root to user. It works perfectly

Upvotes: 1

Related Questions