I am migrating my first flask app to an ubuntu VPS and I figured I’d get a 
simple “Hello, word!” app running before trying to migrate more complex 
code. Unfortunately, configuring mod_wsgi has stopped me dead.


*System specs:*

Ubuntu 16.04

Apache2.4

Python3.6


I plan to use this VPS for multiple small webapps long-term, so I used 
virtualenv to create a virtual environment in the webapp’s root, installed 
flask, and dropped in my “hello world” app per flask’s documentation. Using 
flask’s dev server, I confirmed the virtual environment and flask are both 
working properly.


I begin configuring my virtual host in apache, but this where things 
started to get tricky. Unfortunately, the “sudo apt-get install 
libapache2-mod-wsgi-py3” command installs a version of mod_wsgi compiled 
for python3.5 which will not work in an environment running python3.6 (I 
tried).


After reading the documentation over at 
http://modwsgi.readthedocs.io/en/develop/user-guides/quick-installation-guide.html
 
and https://pypi.python.org/pypi/mod_wsgi, I decide that installing 
mod_wsgi directly into my virtual environment using pip would provide me 
the most flexibility. I confirmed a successful installation into my virtual 
environment using “mod_wsgi-express start-server”.


Here’s where I get stuck. Obviously, I need to tell apache where my 
mod_wsgi installation is, but the referenced documentation gets pretty 
vague in this area. Here are the questions I’m struggling with:


   - If mod_wsgi is located in my virtual environment, how do the 
   instructions for configuring a virtual host at 
   
http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
    apply?


   - https://pypi.python.org/pypi/mod_wsgi seems to indicate that I should 
   to copy the “mod_wsgi-express module-config” output into a wsgi.load file 
   in apache, but wouldn’t that defeat the purpose of installing mod_wsgi into 
   a virtual environment in the first place? What If I wanted to run a 
   parallel app on this VPS using python2.7? Or python3.7 in the future?


   - How can I make sure apache recognizes my mod_wsgi installation in the 
   virtual environment so that after I enable the app's virtual host, apache 
   will restart properly?
   

Any direction on linking a mod_wsgi virtual environment installation to 
apache2.4 would be most helpful. Thanks in advance.

-- 
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.

Reply via email to