Ubuntu, Apache2, Django) Fatal Python error: Py_Initialize: unable to get locale encoding ImportError: no module named 'encodings'

I am trying to configure a django (1.8) application with AWS EC2 with Ubuntu 14.04, Apache2, python 3.4.

When I run "sudo service apache2 start", the page saves the reload, and the same error message flows to '/var/log/apache2/error.log.

Error message

[Friday August 26, 2016] [mpm_event: notice] [pid n: tid m] AH00489: Apache / 2.4.7 (Ubuntu) mod_wsgi / 4.5.5 Python configuration / 3.4.3 - resuming normal operations [Fri Aug 26, 2016] [main: notification] [pid n: tid m] AH00094: Command line: '/ usr / sbin / apache2' Fatal Python error: Py_Initialize: cannot get locale encoding ImportError: There is no module named 'encodings'

My configuration is below:

I added one line: 'Include /etc/apache2/httpd.conf'below '/etc/apache2/apache2.conf'.

'/etc. / apache 2 / httpd.conf '

WSGIScriptAlias / /home/ubuntu/project/project/project/wsgi.py
WSGIDaemonProcess project python-path=/home/ubuntu/project/project
WSGIProcessGroup project
WSGIPythonHome /usr/bin/python3.4

<Directory /home/ubuntu/project/project/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

Alias /static/ /home/ubuntu/project/project/deploy_to_server/
<Directory /home/ubuntu/project/project/deploy_to_server>
Require all granted
</Directory>

I think I did everything that was done without something wrong.

But he continues to keep a journal with the same error. Is there something I am missing?

I changed mod_wsgi/3.x Python/2.7 configuredmod_wsgi/4.5.5 Python/3.4.3 configuredto synchronize version python ALREADY

+4
2

- 'WSGIPythonHome/usr/bin/pytyon3.4' /etc/apache 2/httpd.conf.

.

+2

python virtualenv.

:

WSGIPythonHome /path/to/virtualenv/bin/python3.4

:

WSGIPythonHome /path/to/virtualenv/

WSGI .

0

Source: https://habr.com/ru/post/1652634/


All Articles