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 pip install mod-wsgi
. (where pip is the python3 pip).
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/).
Seems like other poor souls have cried out silently in the dark about the same mix (old centos box, shiny new python version.)
I've read extensively through many online docs, like How to deploy with WSGI and Deploying Django (Django Book), but no one seems to address this particular combination.
I wish IT would let me use a Debian based system, seems like that would be easier.
Here is my apache version info:
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"
Here's a few snips of my httpd.conf file:
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
<Directory /opt/myproject/myapp>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
And here is the latest error I am encountering when I try to start apache:
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)
Grateful for any pointers, advice, wisdom.