Introducing Mailman Web project
I have been working on a new sub-project Mailman Web1. This project basically combines Postorius and Hyperkitty together in a single package which you can easily use to serve Mailman's web interface.
The basic motivation behind this was to make it simpler for people to install the web interface *and* make it easier for people to configure Mailman's web ui.
Both Postorius and Hyperkitty are based on Django Web Framework, which uses settings.py as its default configuration language. While it is quite convenient for Python developers to be able to put Python statements in configuration to join/edit/configure settings. However, I think a traditional INI, or TOML style configuration is easier for non-developers without having to worry about PYTHONPATH, valid Python sytax etc, etc.
For this reason, I decided to combine all the projects together into a Django project which can be easily installed and run:
$ pip install mailman-web
# Export Settings for commands to just work.
$ export DJANGO_SETTINGS=mailman_web.settings
$ django-admin migrate
$ django-admin runserver
This should get you default settings for running. If you want to customize your installation, which you almost always would need to in a prod environment, you can create a config file at one of these locations (which are searched in following order):
- /etc/mailman-web.toml
- /etc/mailman3/mailman-web.toml
- ./mailman-web.toml
Note that we support only TOML as the configuration language3 because of its simplicity. I would have loved to use INI, like Mailman Core, but it turns out to be way too simple to represent more complex data structures like maps and tables, that is commonly used in Django's Settings.
This project is currently in alpha stage (I created it today!), but can be installed with pip5 and in my basic tests works. There isn't much in the project itself beyond some configurations.
I also took this opportunity to document all the settings that are used in Mailman Web (both Postorius and Hyperkitty) together6. This is documented in code and so I really hope that it won't go out of date like many other places ;-) Improvements to docs is very welcome, just a modification of a comment and is quite easy to propose right in your web browser using Gitlab!
Any questions, comments or suggestions are welcome. You can open issues for feature requests on gitlab1 too.
-- thanks, Abhilash Raj (maxking)
- Abhilash Raj:
For this reason, I decided to combine all the projects together into a Django project which can be easily installed and run:
$ pip install mailman-web # Export Settings for commands to just work. $ export DJANGO_SETTINGS=mailman_web.settings $ django-admin migrate $ django-admin runserver
I've tried things a bit differently so I can use the latest version from GitLab, and Things Go Boom(TM):
$ python3.7 -m venv venv $ . venv/bin/activate $ pip install -U pip setuptools $ git clone https://gitlab.com/mailman/mailman-web.git $ cd mailman-web/ $ cp docs/mailman-web-example.toml mailman-web.toml $ pip install . $ DJANGO_SETTINGS_MODULE=mailman_web.settings django-admin migrate Traceback (most recent call last): [...] File "/var/lib/nginx/mailman/venv/lib/python3.7/site-packages/postorius/views/user.py", line 34, in <module> from postorius.models import List, MailmanUser File "/var/lib/nginx/mailman/venv/lib/python3.7/site-packages/postorius/models.py", line 223, in <module> class EmailTemplate(models.Model): File "/var/lib/nginx/mailman/venv/lib/python3.7/site-packages/django/db/models/base.py", line 95, in __new__ "INSTALLED_APPS." % (module, name) RuntimeError: Model class postorius.models.EmailTemplate doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Did I miss something?
-Ralph
On Mon, Mar 25, 2019, at 5:25 PM, Ralph Seichter wrote:
- Abhilash Raj:
For this reason, I decided to combine all the projects together into a Django project which can be easily installed and run:
$ pip install mailman-web # Export Settings for commands to just work. $ export DJANGO_SETTINGS=mailman_web.settings $ django-admin migrate $ django-admin runserver
I've tried things a bit differently so I can use the latest version from GitLab, and Things Go Boom(TM):
$ python3.7 -m venv venv $ . venv/bin/activate $ pip install -U pip setuptools $ git clone https://gitlab.com/mailman/mailman-web.git $ cd mailman-web/ $ cp docs/mailman-web-example.toml mailman-web.toml $ pip install . $ DJANGO_SETTINGS_MODULE=mailman_web.settings django-admin migrate Traceback (most recent call last): [...] File "/var/lib/nginx/mailman/venv/lib/python3.7/site-packages/postorius/views/user.py", line 34, in <module> from postorius.models import List, MailmanUser File "/var/lib/nginx/mailman/venv/lib/python3.7/site-packages/postorius/models.py", line 223, in <module> class EmailTemplate(models.Model): File "/var/lib/nginx/mailman/venv/lib/python3.7/site-packages/django/db/models/base.py", line 95, in __new__ "INSTALLED_APPS." % (module, name) RuntimeError: Model class postorius.models.EmailTemplate doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Did I miss something?
So, that's my fault ;-)
The example configuration is actually not a working example, but only used for demonstrating how to write a TOML config.
But I see that it actually should be a valid configuration, I'll open an issue and fix that.
Can you instead remove mailman-web.toml and then again try:
$ DJANGO_SETTINGS_MODULE=mailman_web.settings django-admin migrate
This should mostly probably work :)
-- thanks, Abhilash Raj (maxking)
- Abhilash Raj:
The example configuration is actually not a working example, but only used for demonstrating how to write a TOML config.
Oh, that comes as a suprise. ;-) I started out with the example config because I wanted to use a PostgreSQL backend later on. SQLite is fine for tests, of course.
But I see that it actually should be a valid configuration, I'll open an issue and fix that.
Thanks.
Can you instead remove mailman-web.toml and then again try [...]
Yup, the builtin config works here.
-Ralph
On Tue, Mar 26, 2019, at 9:34 AM, Ralph Seichter wrote:
- Abhilash Raj:
The example configuration is actually not a working example, but only used for demonstrating how to write a TOML config.
Oh, that comes as a suprise. ;-) I started out with the example config because I wanted to use a PostgreSQL backend later on. SQLite is fine for tests, of course.
In that case, you can copy the the config, remove the INSTALLED_APPS and update the database configuration.
I have updated it, so example config should also work now :)
Thanks for trying it out.
But I see that it actually should be a valid configuration, I'll open an issue and fix that.
Thanks.
Can you instead remove mailman-web.toml and then again try [...]
Yup, the builtin config works here.
-Ralph
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)
On Tue, Mar 26, 2019, at 2:03 PM, Ralph Seichter wrote:
- Abhilash Raj:
I have updated it, so example config should also work now :)
I can confirm that "django-admin migrate" now works with PostgreSQL.
By the way, how about adding wsgi.py and whatever else might be required to allow running with uWSGI?
It is already there (mailman_web.wsgi.application1), I do need to work on docs for that.
It can be updated to set default settings to mailman_web.settings as default settings module in wsgi.py.
-Ralph
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
-- thanks, Abhilash Raj (maxking)
participants (2)
-
Abhilash Raj
-
Ralph Seichter