-
-
Save ivan-hilckov/d606c5a64104f0344ea5670a5e53ca26 to your computer and use it in GitHub Desktop.
Fix: Django Debug Toolbar not showing when using with Docker.
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
# If you don't do this you will have to add the host IP in INTERNAL_IPS = ('127.0.0.1',) | |
# And it will change, then you will have to change INTERNAL_IPS again. | |
def show_toolbar(request): | |
if request.is_ajax(): | |
return False | |
return True | |
DEBUG_TOOLBAR_CONFIG = { | |
'SHOW_TOOLBAR_CALLBACK': 'config.local.show_toolbar', | |
} |
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
# Depending on your requirements, you can do: | |
import socket | |
import os | |
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname()) | |
INTERNAL_IPS = [ip[:-1] + '1' for ip in ips] + ['127.0.0.1', '10.0.2.2'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment