Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable mod_wsgi after pip install

On Ubuntu 14.04 I've upgraded to Python 2.7.11 using apt-get, and installed mod_wsgi using sudo pip install mod_wsgi. Now, how do I enable mod_wsgi in Apache? The install instructions (https://modwsgi.readthedocs.org/en/develop/user-guides/quick-installation-guide.html) only mention building from source..

I've figured out that mod_wsgi-py27.so is in /usr/local/lib/python2.7/dist-packages/mod_wsgi/server, but not sure if I'm supposed to do the rest of the installation by manually editing apache config files..?

This is going to be a production machine that is managed through Puppet by the ops team (iow, it doesn't sound like mod_wsgi-express would be the way to go, but maybe I'm wrong..?)

Update: I might have gotten it to work by apt-get installing the (old) system version, and then hand-editing /etc/apache2/mods-available/wsgi.load to point to the pip-installed (new) mod_wsgi-py27.so. Not sure if this is copacetic, however everything in wsgi.conf is commented out by default so maybe..?

like image 990
thebjorn Avatar asked Mar 01 '16 13:03

thebjorn


1 Answers

While mod_wsgi-express might be great and is highly recommended for the simple set-up, it does have a setup-server command:

mod_wsgi-express setup-server ./my_wsgi.py

That creates a config directory with apachectl, etc. Have a look in that directory to see which httpd.conf directives should be necessary.

like image 131
serv-inc Avatar answered Oct 29 '22 17:10

serv-inc