system-config/playbooks/roles/mailman3/files/web-settings_local.py
Ian Wienand b82c1db735
mailman: set web auto field size to "AutoField"
It seems that in django>=3.2 the assumption that an implicit primary
key would be an AutoField changed to becoming a BigAutoField (64-bit).

django warns now

 Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
 HINT: Configure the DEFAULT_AUTO_FIELD setting or the UsersConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.

I think we took the hint to add this as BigAutoField.

However, it seems that we probably made the db tables with the smaller
field.  When we now start the web container we are told that the
models don't match.  When I ran "makemigrations" it made a bunch of
migration files to update to BigAutoField id's.

Because the migrations are made during the installation (I'm
guessing), the container doesn't have this migration included with it.
I think to avoid getting into a mess of migrations, we should just
leave this as is.

If upstream decides to set this on an application-basis I think that
will override this, and we will get a migration as part of the general
installation and that will work fine.  The problem is just that we're
setting it "outside" the installation.

Change-Id: I1679631cd4f7ea14563aab07ad4450c35aa90fd8
2023-02-10 08:31:04 +11:00

26 lines
912 B
Python

# Override default index system. Xapian will be the default in the next
# major release of mailman3, but is currently recommended.
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'xapian_backend.XapianEngine',
'PATH': "/opt/mailman-web-data/fulltext_index",
},
}
# Disable Gravatar integration since it violates privacy expectations
HYPERKITTY_ENABLE_GRAVATAR = False
# This disables web auth using Google, GitHub, Gitlab, Yahoo,
# Fedora, and generic OpenID.
# TODO: In the future we will want to enable this specifically for
# our keycloak server only.
MAILMAN_WEB_SOCIAL_AUTH = []
FILTER_VHOST = True
# See
# https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys
# We set this to AutoField to avoid unwanted migrations as we've
# already created the models with the smaller field size.
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'