On 2023-02-15 18:35:35 -0800 (-0800), Mark Sapiro wrote:
On 2/15/23 07:52, Jeremy Stanley wrote:
Thanks, I'm still doing my best to wrap my brain around how Django uses database migrations to create sites (seems like a very strange use of a migration, I'm only accustomed to seeing them applied for database schema updates).
I don't think it does. There are a couple of migrations at django/contrib/sites/migrations, but these are only the initial creation of the model and an update to make the domain field unique.
Why do you think it creates sites in this way. [...]
Clearly a total misreading on my part of the Django documentation to which you referred earlier. It talks about having to feed Django multiple settings.py files with different SITE_ID values and running migrate to configure them, then links to the document on migrations which starts out explaining how to use makemigrations to create them. I took that to mean creating and configuring Django sites from the command line required supplying customized database migrations.
The particularly misleading bits are where it says:
"To set the correct name and domain for your project, you can
use a data migration."
"In order to serve different sites in production, you’d create a
separate settings file with each SITE_ID"
It doesn't seem to talk about using django_admin at all (or if it does, it's not mentioned by name, maybe assuming the reader knows to use it in order to perform the necessary steps).
Thanks for the clear examples! If these are available somewhere in Django's documentation, I did a terrible job of searching for them.
you need to create a domain in Postorius. Look at the code behind Postorius add new domain. Or you can create the domain in core via REST, but you then have to modify it in Postorius to associate the correct site. [...]
Much appreciated, this was the other bit that was non-obvious to me. I guess you're saying Postorius's view of domains is independent from what's in Mailman Core, and there's no documented CLI/API for manipulating that in Postorius so I'll need to write one based on a reverse-engineering of its source code? Sounds doable now that I know where to look. Thanks again!
Jeremy Stanley