Ticket 23829

This pull requests fixes the actual problem with #23829 and also makes the command work if django.contrib.sites is not installed.

`django.contrib.sites` will default to the current requests to get the domain, but this is not applicable when running as a management command.

I could not find any existing tests for this, so I did not know which tests to enhance. However, I will work on writing some mocks to ensure that the request is being passed correctly.
Can you update this line to include the call signature (like here https://github.com/django/django/pull/3527/files)?