Where the last line only retrieves the IP of the current machine. I'd argue that adding the line socket.gethostname() by itself would be beneficial, as more often than not you access the webpage in a local environment by its name rather than its ip.
Using the other value in the array returned by socket.gethostbyname_ex() returns the hostname with the domain attached, and as such might be less useful than simply socket.gethostname()
Currently, the settings.py file for Django contains the following allowed hosts:
https://github.com/Basico-PS/AutomationOrchestrator/blob/ab6943af76eab9002f313399ff0414246d4db257/automation_orchestrator/automation_orchestrator/settings.py#L70-L72
Where the last line only retrieves the IP of the current machine. I'd argue that adding the line
socket.gethostname()
by itself would be beneficial, as more often than not you access the webpage in a local environment by its name rather than its ip.Using the other value in the array returned by
socket.gethostbyname_ex()
returns the hostname with the domain attached, and as such might be less useful than simplysocket.gethostname()