title: Deploy a python3.4-based Django project on Centos 6.5 with mod_wsgi: doable?
body: <p>I have a project that works very nicely using the dev web server but I'm running into tons of problems getting it to play nice on an old-ish centos box with the system apache (ie installed via yum.)  I uninstalled the yum-based wsgi (because it was assuredly compiled against the system python 2.x) and am trying to use the one that got install via <code>pip install mod-wsgi</code>.  (where pip is the python3 pip).</p>
  
  <p>Before I get into the details, I want to just ask the internet -- is this even possible / advisable?  Should I uninstall apache and try to build a new version from source?  Should I be using a virtual-env?  Pyenv or Virtualenv?  If so, should mod-wsgi be installed in the project's venv or in "system" location of python3 (/usr/local/).</p>
  
  <p>Seems like other poor souls have <a href="https://stackoverflow.com/questions/27606529/config-mod-wsgi-and-python-django-on-centos-6-5-fail">cried out silently</a> in the dark about the same mix (old centos box, shiny new python version.)</p>
  
  <p>I've read extensively through many online docs, like <a href="https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/" rel="nofollow noreferrer">How to deploy with WSGI</a> and <a href="http://www.djangobook.com/en/2.0/chapter12.html" rel="nofollow noreferrer">Deploying Django (Django Book)</a>, but no one seems to address this particular combination. </p>
  
  <p>I wish IT would let me use a Debian based system, seems like that would be easier.</p>
  
  <p>Here is my apache version info:</p>
  
  <pre><code>apachectl -V
  Server version: Apache/2.2.15 (Unix)
  Server built:   Aug 18 2015 02:00:22
  Server's Module Magic Number: 20051115:25
  Server loaded:  APR 1.3.9, APR-Util 1.3.9
  Compiled using: APR 1.3.9, APR-Util 1.3.9
  Architecture:   64-bit
  Server MPM:     Prefork
    threaded:     no
      forked:     yes (variable process count)
  Server compiled with....
   -D APACHE_MPM_DIR="server/mpm/prefork"
   -D APR_HAS_SENDFILE
   -D APR_HAS_MMAP
   -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
   -D APR_USE_SYSVSEM_SERIALIZE
   -D APR_USE_PTHREAD_SERIALIZE
   -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
   -D APR_HAS_OTHER_CHILD
   -D AP_HAVE_RELIABLE_PIPED_LOGS
   -D DYNAMIC_MODULE_LIMIT=128
   -D HTTPD_ROOT="/etc/httpd"
   -D SUEXEC_BIN="/usr/sbin/suexec"
   -D DEFAULT_PIDLOG="run/httpd.pid"
   -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
   -D DEFAULT_LOCKFILE="logs/accept.lock"
   -D DEFAULT_ERRORLOG="logs/error_log"
   -D AP_TYPES_CONFIG_FILE="conf/mime.types"
   -D SERVER_CONFIG_FILE="conf/httpd.conf"
  </code></pre>
  
  <p>Here's a few snips of my httpd.conf file:</p>
  
  <pre><code>LoadModule wsgi_module /opt/deeplogic-django/venv/lib/python3.4/site-packages/mod_wsgi/server/mod_wsgi-py34.cpython-34m.so
  # lines omitted....
  WSGIScriptAlias / /opt/myproject/myapp/wsgi.py
  WSGIPythonPath /opt/myproject:/opt/myproject/venv/lib/python3.4/site-packages                           
  WSGIPythonHome /opt/myproject/venv/bin
  &lt;Directory /opt/myproject/myapp&gt;
  &lt;Files wsgi.py&gt;
         Order deny,allow
         Allow from all
  &lt;/Files&gt;
  &lt;/Directory&gt;
  </code></pre>
  
  <p>And here is the latest error I am encountering when I try to start apache:</p>
  
  <pre><code>Fatal Python error: Py_Initialize: Unable to get the locale encoding
  ImportError: No module named 'encodings'
  [Thu Sep 17 11:51:47 2015] [notice] child pid 1393 exit signal Aborted (6)
  </code></pre>
  
  <p>Grateful for any pointers, advice, wisdom.</p>