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.
For example, my dev url is: https://<dev machine ip>/myproject/dashboard/data
My prod url may be https://companyname.com/myproject/dashboard/data
Expected:
for dev:
https://<dev machine ip>/myproject
for prod:
https://companyname.com/myproject
I would not like to hard code the url. How to get the full url or root url inside command file below?
class Command(BaseCommand):
def handle(self, *args, **options):
url = "url" # need to get url here