2👍
Nope, as far as I know there’s no way of doing that from a management command. As you’ve realized yourself, you use part of the request
information to build the full URL, and when you launch a management command from the console there’s no request.
What I’ve done in my projects is setting up a variable called BASE_URL
in the settings
with your base domain and using it to build your URL.
You can also check the sites framework: https://docs.djangoproject.com/en/dev/ref/contrib/sites/
Source:stackexchange.com