I’d thought something like this is a FAQ but the database docs on postgres don’t write a bit about forcing Django to connect using SSL to the database server.
After lots of googling (and finding hundreds of guides how to set up a Django with HTTPS) and finding out by try-and-error, behold the solution:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dbname',
'USER': 'dbuser',
'PASSWORD': 'dbpassword',
'HOST': 'dbhost',
'OPTIONS': {
'sslmode': 'require',
},
},
}