django_aws_utils.ec2_ip
¶
Module Contents¶
Functions¶
|
Get the machine’s IP as used by the load balancer. |
-
django_aws_utils.ec2_ip.
get_ec2_ip
() → str¶ Get the machine’s IP as used by the load balancer.
The result should be added to ALLOWED_HOSTS to prevent Django from returning HTTP500. For example, in your settings.py:
ALLOWED_HOSTS = [ get_ec2_ip(), "app.example.com" ]
For the time being, this only supports the Metadata Version 1.
- Returns
A string containing the instance’s IPv4