Ubuntu , Apache2 , Django ) Fatal Python error: Py_Initialize: Unable to get the locale encoding ImportError: No module named 'encodings'
<p>I'm trying to set up my <strong>django(1.8)</strong> application with <strong>AWS EC2</strong> having <strong>Ubuntu 14.04 , Apache2 , python 3.4.</strong></p>

<p>When I run 'sudo service apache2 start' , the page keeps re-loading and the same error message is stacking at '/var/log/apache2/error.log'.</p>

<p>The error message is</p>

<blockquote>
  <p>[Fri Aug 26 2016] [mpm_event:notice] [pid n:tid m] AH00489: Apache/2.4.7 (Ubuntu) mod_wsgi/4.5.5 Python/3.4.3 configured -- resuming normal operations
  [Fri Aug 26 2016] [core:notice] [pid n:tid m] AH00094: Command line: '/usr/sbin/apache2'
  <strong>Fatal Python error: Py_Initialize: Unable to get the locale encoding
  ImportError: No module named 'encodings'</strong></p>
</blockquote>

<p>My configuration is below :</p>

<p>I added one line: <code>'Include /etc/apache2/httpd.conf'</code>  at the bottom of <code>'/etc/apache2/apache2.conf'</code>.</p>

<blockquote>
  <p>'/etc/apache2/httpd.conf'
  :</p>
</blockquote>

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

&lt;Directory /home/ubuntu/project/project/project&gt;
&lt;Files wsgi.py&gt;
Require all granted
&lt;/Files&gt;
&lt;/Directory&gt;

Alias /static/ /home/ubuntu/project/project/deploy_to_server/
&lt;Directory /home/ubuntu/project/project/deploy_to_server&gt;
Require all granted
&lt;/Directory&gt;
</code></pre>

<p>I think I did it all done without something wrong.</p>

<p>But it keeps logging with the same error.
Is there anything I'm missing?</p>

<p>I did change <code>mod_wsgi/3.x Python/2.7 configured</code> --> <code>mod_wsgi/4.5.5 Python/3.4.3 configured</code> for synchronizing the python version ALREADY</p>

<p>It was because of the line 'WSGIPythonHome /usr/bin/pytyon3.4' in /etc/apache2/httpd.conf.</p>

<p>Without this line, it runs without error thank you</p>

python django apache ubuntu mod-wsgi