Fixed #24036 -- Added ignore_warnings decorator

To make it less general, `message="Overriding setting DATABASES can lead to unexpected behavior"` can be passed here.