Firstly, I want to say that I'm a beginner in Django.
I'm looking for a simple way to retrieve the domain name of my Django website.
I want to do this in my settings.py. I've already tried with the socket something like this:
socket.gethostname()
but this doesn't work correctly.
If you have a request object,do
request.META['HTTP_HOST']
This would return the hostname
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With