Setup Mailman 3 using Apache/Mod_WSGI
Hi all,
I'm trying to setup Mailman 3 to run using apache. I've downloaded and installed mailman core, django, Postorius & Hyperkitty I'm using the mailman-suite django project from https://gitlab.com/mailman/mailman-suite/tree/master <https://gitlab.com/mailman/mailman-suite/tree/master>. When I run the site using Django's development server everything works. However I've been unsuccessful in getting the site to run via apache w/ Mod_WSGI.
Note: I have a number of virtual hosts setup for various PHP sites and am trying to add the mailman install as another virtual host. I'm using MAMP for managing my website setup on my local machine.
The addition to the virtual hosts file is:
<VirtualHost *:80> #Mailman3 stuff ServerName mailman.local
Alias /static /Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/static <Directory "/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/static"> Order deny,allow Allow from all </Directory>
WSGIScriptAlias / /Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/wsgi.py
<Directory "/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project"> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> </VirtualHost>
I also have the following in my https.conf.
WSGIPythonPath /Applications/MAMP/Library/lib/python2.7/
The 500 and related Errors I'm getting in Apache are:
[Thu Aug 03 14:18:55 2017] [info] mod_wsgi (pid=80044): Create interpreter 'mailman.local|'. [Thu Aug 03 14:18:55 2017] [info] mod_wsgi (pid=80044): Adding '/Applications/MAMP/Library/lib/python2.7/' to path. [Thu Aug 03 14:18:55 2017] [info] [client ::1] mod_wsgi (pid=80044, process='', application='mailman.local|'): Loading WSGI script '/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/wsgi.py'. [Thu Aug 03 14:18:55 2017] [error] [client ::1] mod_wsgi (pid=80044): Target WSGI script '/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/wsgi.py' cannot be loaded as Python module. [Thu Aug 03 14:18:55 2017] [error] [client ::1] mod_wsgi (pid=80044): Exception occurred processing WSGI script '/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/wsgi.py'. [Thu Aug 03 14:18:55 2017] [error] [client ::1] Traceback (most recent call last): [Thu Aug 03 14:18:55 2017] [error] [client ::1] File "/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/wsgi.py", line 38, in <module> [Thu Aug 03 14:18:55 2017] [error] [client ::1] application = get_wsgi_application() [Thu Aug 03 14:18:55 2017] [error] [client ::1] File "/Applications/MAMP/Library/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application [Thu Aug 03 14:18:55 2017] [error] [client ::1] django.setup(set_prefix=False) [Thu Aug 03 14:18:55 2017] [error] [client ::1] File "/Applications/MAMP/Library/lib/python2.7/site-packages/django/__init__.py", line 22, in setup [Thu Aug 03 14:18:55 2017] [error] [client ::1] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) [Thu Aug 03 14:18:55 2017] [error] [client ::1] File "/Applications/MAMP/Library/lib/python2.7/site-packages/django/conf/__init__.py", line 56, in __getattr__ [Thu Aug 03 14:18:55 2017] [error] [client ::1] self._setup(name) [Thu Aug 03 14:18:55 2017] [error] [client ::1] File "/Applications/MAMP/Library/lib/python2.7/site-packages/django/conf/__init__.py", line 41, in _setup [Thu Aug 03 14:18:55 2017] [error] [client ::1] self._wrapped = Settings(settings_module) [Thu Aug 03 14:18:55 2017] [error] [client ::1] File "/Applications/MAMP/Library/lib/python2.7/site-packages/django/conf/__init__.py", line 110, in __init__ [Thu Aug 03 14:18:55 2017] [error] [client ::1] mod = importlib.import_module(self.SETTINGS_MODULE) [Thu Aug 03 14:18:55 2017] [error] [client ::1] File "/Applications/MAMP/Library/lib/python2.7/importlib/__init__.py", line 37, in import_module [Thu Aug 03 14:18:55 2017] [error] [client ::1] __import__(name) [Thu Aug 03 14:18:55 2017] [error] [client ::1] ImportError: No module named settings
Any thoughts would be greatly appreciated.
Thank you, -Erin Justice
Erin Justice writes:
The addition to the virtual hosts file is:
<VirtualHost *:80> #Mailman3 stuff ServerName mailman.local
Alias /static /Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/static <Directory "/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/static"> Order deny,allow Allow from all </Directory>
WSGIScriptAlias / /Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/wsgi.py
<Directory "/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project"> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> </VirtualHost>
All of the above looks OK to me.
I also have the following in my https.conf.
WSGIPythonPath /Applications/MAMP/Library/lib/python2.7/
I think this is unnecessary as long as python is getting run: it knows where to find itself. On the other hand, you need to tell WSGI where the Django project (mailman-suite_project?) lives. I use a different syntax:
WSGIDaemonProcess site python-path=/home/django/project user=django group=django display-name=django
where ~django/project is the Django project root, containing manage.py and site/, where site/ contains settings.py, wsgi.py, and all that stuff. So my guess is you need
WSGIPythonPath /Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/
I'm not sure why that ended up in httpd.conf. WSGIDaemonProcess works fine for me in the VirtualHost stanza that configures Mailman.
Steve
On 08/03/2017 07:16 PM, Stephen J. Turnbull wrote:
On the other hand, you need to tell WSGI where the Django project (mailman-suite_project?) lives. I use a different syntax:
WSGIDaemonProcess site python-path=/home/django/project user=django group=django display-name=django
And on the apache/MM3/mod_wsgi site I support, I have
WSGIDaemonProcess mailman-web display-name=mailman-web maximum-requests=1000 umask=0002 user=mailman group=mailman python-path=/opt/mailman/mailman-bundler/venv/lib/python2.7/site-packages home=/opt/mailman/mailman-bundler/var
I also have
WSGIScriptAlias /mm3
/opt/mailman/mailman-bundler/bin/mailman-web.wsgi <Directory "/opt/mailman/mailman-bundler/bin"> <Files mailman-web.wsgi> Order deny,allow Allow from all Require all granted </Files> WSGIProcessGroup mailman-web </Directory>
Which is essentially what the OP has with the addition of WSGIProcessGroup mailman-web
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Hi Mark and Stephen,
Thanks for your examples. They helped me confirm that I needed to look into a different area than the Apache config. Ultimately I needed to use the extra code that is commented out in the wsqi.py file that is part of the mailman-suite Django project. Why I didn't realize this sooner? Chock it up to inexperience with python and trying the wrong combination of things at the wrong times.
Just for the sake of anyone else looking through the archives I was able to get away with just using the following in my virtual hosts file. <VirtualHost *:80> #Mailman3 stuff ServerName mailman.local
Alias /static /Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/static <Directory "/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/static"> Order deny,allow Allow from all </Directory>
WSGIScriptAlias / /Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project/wsgi.py <Directory "/Applications/MAMP/Library/lib/python2.7/site-packages/mailman-suite/mailman-suite_project"> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory> </VirtualHost>
-Erin
participants (3)
-
Erin Justice
-
Mark Sapiro
-
Stephen J. Turnbull