Thanks you.  I've got both apps/sites running on express - I just need to 
install apache and setup the reverse proxy.  The pip install made it fairly 
easy.

I hope to write this all up as a complete "recipe"  when I have this completed 
in case someone else need the same or similar.

Appreciate your work on this and the support!

Best Regards,
Charles

________________________________
From: [email protected] <[email protected]> on behalf of Graham 
Dumpleton <[email protected]>
Sent: Saturday, September 5, 2020 6:00 PM
To: [email protected] <[email protected]>
Subject: Re: [modwsgi] Writing a recipe to run a python2 and python3 apps with 
a system apache instance as reverse proxy



On 6 Sep 2020, at 5:20 am, Charles Medcoff 
<[email protected]<mailto:[email protected]>> wrote:

Hello all,

First off apologies if some of this has been covered, I'll continue to search 
this group and net for solutions.  I'm trying to run a Django app (Mezzanine) 
and MoinMoin.  Mezz is going to run on python3 and MoinMoin python 2 as it's 
not yet been ported to 3.  I understand the risks of running python2 and I'm 
fine with that.

I learned that this was possible from this 
link<http://blog.bsmithers.co.uk/2017/10/python2-python3-on-the-same-apache-server/#:~:text=All%20was%20well%20when%20testing,starts%20to%20explain%20the%20solution.>
 but he doesn't go into too much detail - at least not enough for me to 
completely figure this out.  From there he references 
this<http://blog.dscpl.com.au/2015/04/introducing-modwsgi-express.html> and 
that helps some more, but doesn't cover my "use case" if you will.  The 
following are the steps I think that I need to follow but looking for some 
feedback as I'm on my third Azure Ubuntu image trying to get this figured out.

1. After creating my baseline VM image which does not include Apache by 
default, but does include both python2 and python3, create python virtual 
environments for each app using python2 and python3 respectively and install 
mod_wsgi-express into each using pip using the following commands:

     pip install mod_wsgi-httpd
     pip install mod_wsgi

Why don't you just install the system Apache for Ubuntu into your image if you 
have the ability to run stuff as root? It is still better to use the system 
Apache if you can, relying on mod_wsgi-httpd should only be done as a last 
resort.

Also, instead of those two pip commands, it is better to use just:

    pip install mod_wsgi-standalone

if you really need to have Apache installed as part of mod_wsgi-express in 
Python virtual environment. That one package combines installation of both of 
the above so that can list it in a requirements.txt file for pip, otherwise 
they original packages have to be installed one at a time.

I believe this will position me to be able to run any mod_wsgi-express command 
to either run each app its own non-root user port.  The 2nd link tells how to 
serve my app and my static files separately as one would like to do in a 
production environment which is my target here.

3 (yes this 3 I'll come back to 2)  - This is a bit of guess...the "Connecting 
into Apache installation" section of this 
link<https://pypi.org/project/mod-wsgi/> explains  how I can use the 
'module-config' parameter to mod_wgsi-express to generate configuration for my 
main/system apache install to load two separate mod_wsgi modules, one from my 
python3 virtual environment that I created for Mezz and one from my python2 
virtual environment created for MoinMoin.

You said you had no system Apache, so using 'module-config' doesn't really make 
any sense. Even if you had a system Apache (with or without using 
mod_wsgi-httpd), you don't need to add mod_wsgi configuration to the system 
Apache configuration directly. All you need to do is configure the system 
Apache to proxy to the two separate mod_wsgi-express instances.

2 - What is the correct way for me to install my main/system apache instance 
such that I can complete step 3?

Install the system Apache using Ubuntu packaging tools. You don't need to 
configure it to use mod_wsgi.

4 - finally I realize there is some main/system apache configuration to do to 
point the main/system apache instance to run as a reverse proxy to the app 
virtual environments (Mezz and MoinMoin).  That seems to be covered by the 
first link.

Also see:

http://blog.dscpl.com.au/2015/06/proxying-to-python-web-application.html
http://blog.dscpl.com.au/2015/07/redirection-problems-when-proxying-to.html

Ignore that it is talking about proxying to docker containers, it is still 
relevant.

I hope my questions make sense, and appreciate any assistance.

Best Regards,
cmedcoff





--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/999c6551-8964-41ee-a91c-12daf98d3b49n%40googlegroups.com<https://groups.google.com/d/msgid/modwsgi/999c6551-8964-41ee-a91c-12daf98d3b49n%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/8E5E166B-7441-4E96-A7D4-A9036A64A8BA%40gmail.com<https://groups.google.com/d/msgid/modwsgi/8E5E166B-7441-4E96-A7D4-A9036A64A8BA%40gmail.com?utm_medium=email&utm_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/DM6PR11MB31150B839EEA5D894A026F99CC2B0%40DM6PR11MB3115.namprd11.prod.outlook.com.

Reply via email to