Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement - Add hostname to allowed_hosts #63

Closed
tikki100 opened this issue May 6, 2021 · 1 comment
Closed

Enhancement - Add hostname to allowed_hosts #63

tikki100 opened this issue May 6, 2021 · 1 comment

Comments

@tikki100
Copy link

tikki100 commented May 6, 2021

Currently, the settings.py file for Django contains the following allowed hosts:

ALLOWED_HOSTS = ['127.0.0.1',
'localhost',
socket.gethostbyname_ex(socket.gethostname())[-1][-1]]

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()

@mbalslow
Copy link
Member

Solved by 9688e30 and will be available in next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants