There is a non-development use case here, which is being able to accept the IP range for a subnet used in an EC2 VPC (used by load balancers for health checks). Sure, I could iterate through all the potential IPs and add them, divine a way <http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib> to (maybe) discover it via the socket module, or make an HTTP request to retrieve it from the EC2 meta data API, but this seems like another time when being concise and explicit about the allowed IPs/subnets (without requiring a network call from settings.py) would be helpful. Using the established convention of subnets rather than wildcards would be preferred, IMHO.
Tobias On Wed, Nov 23, 2016 at 11:40 AM, 'Tom Evans' via Django developers (Contributions to Django itself) <django-developers@googlegroups.com> wrote: > On Sat, Nov 19, 2016 at 1:01 AM, Florian Apolloner > <f.apollo...@gmail.com> wrote: > > On Thursday, November 17, 2016 at 5:07:07 PM UTC+1, Tom Evans wrote: > >> > >> Or: > >> from socket import gethostname, gethostbyname > >> ALLOWED_HOSTS = [ gethostname(), gethostbyname(gethostname()), ] > > > > > > That a) adds your hostname and b) (assuming you properly configured your > > system) 127.0.0.1 -- so as long as they are using 192.* to access the > site, > > this does not help. > > Our servers are configured such that "localhost" resolves to > 127.0.0.1, and the hostname resolves to the local IP of the server. > > I don't think our servers are in any way misconfigured, or configured > in a "special" manner - my laptop is configured in precisely the same > manner out of the box. > > The offered solution works correctly on all of our development and > production servers, and also on our developers local machines running > various versions of Linux. > > Cheers > > Tom > > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To post to this group, send email to django-developers@googlegroups.com. > Visit this group at https://groups.google.com/group/django-developers. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/django-developers/CAFHbX1K_1dCLrMQm4cy0u1i1cnEzLJV%2Bb_1- > p9n58ERV7%3Dghvg%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. > -- *Tobias McNulty*Chief Executive Officer tob...@caktusgroup.com www.caktusgroup.com -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMGFDKRa3AkU18jCTtyO-XFmm%2BeQBWjTHuOQXegC%2ByNMPB%3D0Xg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.