title: how to get root url inside command in django
body: <p>I wrote a command to be called by cron in django project. we need to print the full url to my django project. But the dev url is different from prod url. </p>
  
  <p>For example, my dev url is: <code>https://&lt;dev machine ip&gt;/myproject/dashboard/data</code></p>
  
  <p>My prod url may be <code>https://companyname.com/myproject/dashboard/data</code></p>
  
  <p>Expected:</p>
  
  <p>for dev:
  <code>https://&lt;dev machine ip&gt;/myproject</code></p>
  
  <p>for prod:
  <code>https://companyname.com/myproject</code></p>
  
  <p>I would not like to hard code the url. How to get the full url or root url inside command file below?</p>
  
  <pre><code>class Command(BaseCommand):
          def handle(self, *args, **options):
                  url = "url" # need to get url here
  </code></pre>