I am trying to setup a simple Django app using this tutorial:
https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-apache-and-mod_wsgi-on-ubuntu-14-04

My configuration is:
Ubuntu 12.04, Apache/2.4.7, libapache2-mod-wsgi-py3, Python 3.4, Django 1.86

I keep getting the following error in the apache log whenever I try to 
access the server using its IP:

    ImportError: No module named 'encodings'
    Fatal Python error: Py_Initialize: Unable to get the locale encoding
    ImportError: No module named 'encodings'
    [Sat Nov 07 01:26:56.505373 2015] [core:notice] [pid 20920:tid 
140075144152960] AH00051: child pid 21716 exit signal Aborted (6), possible 
coredump in /etc/apache2
    [Sat Nov 07 01:26:56.505478 2015] [core:notice] [pid 20920:tid 
140075144152960] AH00051: child pid 21717 exit signal Aborted (6), possible 
coredump in /etc/apache2
    Fatal Python error: Py_Initialize: Unable to get the locale encoding
    ImportError: No module named 'encodings'

My virtual hosts file looks as follows:

    <VirtualHost *:80> 
    
    ServerAdmin 
        ServerName example.com
        ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public_html
        
        Alias /static /home/admin/myproject/static
        <Directory /home/admin/myproject/static>
            Require all granted
        </Directory>
        
        <Directory /home/admin/myproject/myproject>
            <Files wsgi.py>
                Require all granted
            </Files>
        </Directory>
        
        WSGIDaemonProcess myproject 
python-path=/home/admin/myproject:/home/admin/myproject/myprojectenv/lib/python3.4/site-packages
        WSGIProcessGroup myproject
        WSGIScriptAlias / /home/admin/myproject/myproject/wsgi.py    
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined    
    
    </VirtualHost>  
   
Note: There were no errors while setting up Django in the virtualenv. It 
may be a problem with the PythonPath, buI think I have specified it 
correctly via the python-path option in the WSGIDaemonProcess directive.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b634bd86-7e12-42e1-a3ca-95aa0749dbc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to