I work at a large electronics company and am trying to make some simple web
apps on our department’s server.
Server version: Apache/2.2.3
Architecture: 64-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
With many previous apps hosted on it and Python versions installed, I don’t
want to make many global changes to break existing apps. My plan was to
use Flask with the recommended virtualenv solution. I created the
virtualenv with python2.7 from anaconda, then pip-installed flask and
mod_wsgi 4.5.22 while venv was active.
I confirmed version matching with:
ldd
/home/my-username/public_html/rrfexpire/venv/lib/python2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so
which returned:
libpython2.7.so.1.0 => /usr/local/bin/anaconda/lib/libpython2.7.so.1.0
my rrfexpire.wsgi:
activate_this =
'/home/my-username/public_html/rrfexpire/venv/bin/activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
import sys
sys.path.insert(0, '/home/my-username/public_html/rrfexpire/venv')
from rrfexpire import app as application
In httpd.conf, previous users have working flask apps configured as:
WSGIPythonHome /usr/local/bin/anaconda3
WSGIDaemonProcess Repeaters user=apache group=apache threads=5
display-name=flasker
WSGIScriptAlias /reticlerepeat /var/www/flask/repeaters/repeaters.wsgi
<Directory /var/www/flask/repeaters>
AuthType Basic
AuthName "ProbeEng Webserver: Enter Your Tech Username and Password"
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthLDAPURL "ldap://ldap.city.tech.com/ou=mtworkers,o=tech.com?uid"
##### Require Authentication
#
Require valid-user
WSGIProcessGroup Repeaters
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
For my app, I tried to contain it in a VirtualHost:
VirtualHost *>
ServerName lelrdaapps01.city.Tech.com:80
ErrorLog /home/my-username/public_html/rrfexpire/error.log
LogLevel debug
WSGIDaemonProcess rrfexpire
python-home=/home/my-username/public_html/rrfexpire/venv
python-path=/home/my-username/public_html/rrfexpire/venv/lib/python2.7/site-packages/
user=apache group=apache
WSGIScriptAlias /rrfexpire
/home/my-username/public_html/rrfexpire/rrfexpire.wsgi
<Directory /home/my-username/public_html/rrfexpire>
WSGIProcessGroup rrfexpire
WSGIApplicationGroup %{GLOBAL}
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Error logs confirm my app is attempting to use Anaconda3, but it seems to
never successfully attach the interpreter.
[Thu Dec 21 19:39:54 2017] [info] mod_wsgi (pid=18998): Starting process
'rrfexpire' with uid=48, gid=48 and threads=15.
[Thu Dec 21 19:39:54 2017] [info] mod_wsgi (pid=18998): Python home
/usr/local/bin/anaconda3.
[Thu Dec 21 19:39:54 2017] [info] mod_wsgi (pid=18998): Initializing Python.
[Thu Dec 21 19:39:54 2017] [info] mod_wsgi (pid=19000): Python home
/usr/local/bin/anaconda3.
[Thu Dec 21 19:39:54 2017] [info] mod_wsgi (pid=19000): Initializing Python.
[Thu Dec 21 19:39:54 2017] [info] mod_wsgi (pid=18997): Attach interpreter
''.
[Thu Dec 21 19:39:54 2017] [info] mod_wsgi (pid=18996): Attach interpreter
''.
I believe my app would work fine if it would use the interpreter and
packages installed in the venv, but the WSGIPythonHome path above my
VirtualHost is overriding that. I am able to get ‘Hello World’ by using
the python3 syntax for activate_this in the rrfexpire.wsgi file. But when
I call on other packages that I have installed in my venv, they will often
not exist in the Anaconda3 directory, breaking my app.
Are there any obvious methods I’m overlooking to set a python-home for my
virtualenv, without breaking existing apps?
I’m willing to fight through this, but this previous problem
<https://groups.google.com/forum/#!searchin/modwsgi/pythonhome%7Csort:date/modwsgi/1oEuIHDiCbM/nLNL-TXTAQAJ>
makes me afraid that this will be above my abilities.
There are good instructions here
<https://groups.google.com/forum/#!searchin/modwsgi/anaconda%7Csort:date/modwsgi/w6-31hnZlBo/hyQGpNQnFwAJ>
(May 9) for using Anaconda Python with mod_wsgi, but I am afraid the first
step of removing system-wide mod_wsgi will break existing production apps.
Thanks, Neil
--
You received this message because you are subscribed to the Google Groups
"modwsgi" 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 https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.