Created
January 28, 2020 16:53
-
-
Save bdunnette/d46310324cc7f001763a33f294f3cd58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get local hostname & IP, add these to Django's ALLOWED_HOSTS | |
| import socket | |
| import netifaces as ni | |
| DEFAULT_INTERFACE = os.getenv('DEFAULT_INTERFACE', default='enp3s4f0') | |
| DEFAULT_IP = ni.ifaddresses(DEFAULT_INTERFACE)[ni.AF_INET][0]['addr'] | |
| DEFAULT_HOSTNAME = socket.gethostname() | |
| ALLOWED_HOSTS = ['localhost', '127.0.0.1', DEFAULT_IP, DEFAULT_HOSTNAME] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment