netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.27k stars 2.59k forks source link

Django toolbar doesn't appear #4376

Closed sasa1199 closed 4 years ago

sasa1199 commented 4 years ago

Environment

Python version: 3.6.9 NetBox version: Example: 2.7.3

Hi! I have a problem with the Django Toolbar. I set the debug mode: True and tried all the steps from the official installation as well to solve the problem, but the toolbar on the site still doesn't show up. Can somebody help me?

netbox/netbox/settings.py:

DEBUG = getattr(configuration, 'DEBUG', True)
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'debug_toolbar',
    'cacheops',
    'corsheaders',
    'django_filters',
    'django_rq',
    'django_tables2',
    'django_prometheus',
    'mptt',
    'rest_framework',
    'taggit',
    'taggit_serializer',
    'timezone_field',
    'circuits',
    'dcim',
    'ipam',
    'extras',
    'secrets',
    'tenancy',
    'users',
    'utilities',
    'virtualization',
    'drf_yasg',
]

MIDDLEWARE = (
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django_prometheus.middleware.PrometheusBeforeMiddleware',
    'corsheaders.middleware.CorsMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'utilities.middleware.ExceptionHandlingMiddleware',
    'utilities.middleware.LoginRequiredMiddleware',
    'utilities.middleware.APIVersionMiddleware',
    'extras.middleware.ObjectChangeMiddleware',
    'django_prometheus.middleware.PrometheusAfterMiddleware',
)
INTERNAL_IPS = (
    '127.0.0.1',
    '::1',
)

DEBUG_TOOLBAR_PANELS = [
    'debug_toolbar.panels.versions.VersionsPanel',
    'debug_toolbar.panels.timer.TimerPanel',
    'debug_toolbar.panels.settings.SettingsPanel',
    'debug_toolbar.panels.headers.HeadersPanel',
    'debug_toolbar.panels.request.RequestPanel',
    'debug_toolbar.panels.sql.SQLPanel',
    'debug_toolbar.panels.staticfiles.StaticFilesPanel',
    'debug_toolbar.panels.templates.TemplatesPanel',
    'debug_toolbar.panels.cache.CachePanel',
    'debug_toolbar.panels.signals.SignalsPanel',
    'debug_toolbar.panels.logging.LoggingPanel',
    'debug_toolbar.panels.redirects.RedirectsPanel',
    'debug_toolbar.panels.profiling.ProfilingPanel',
 ]

netbox/netbox/urls.py

if settings.DEBUG:
    import debug_toolbar
    urlpatterns = [
        path('__debug__/', include(debug_toolbar.urls)),
    ] + urlpatterns
hSaria commented 4 years ago

If the NetBox instance is not running locally (i.e. you're accessing a remote server), then you need to add your IP to INTERNAL_IPS as per the debug toolbar's documentation.

sasa1199 commented 4 years ago

If the NetBox instance is not running locally (i.e. you're accessing a remote server), then you need to add your IP to INTERNAL_IPS as per the debug toolbar's documentation.

Hi! I run it locally python3 manage.py runserver 0.0.0.0:8000 --insecure or python3 manage.py runserver 0.0.0.0:8000, but still doesn't show up

hSaria commented 4 years ago

I've just configured it and can confirm it works. This is probably a discussion best suited for the mailing list.

sasa1199 commented 4 years ago

I've just configured it and can confirm it works. This is probably a discussion best suited for the mailing list.

Okay, I've made a discussion https://groups.google.com/forum/#!topic/netbox-discuss/sLwXQp7ZkYA

sasa1199 commented 4 years ago

Well it's still unsolved, nobody gave me the answer, why is the toolbar doesn't show up

hSaria commented 4 years ago

You just created a forum discussion with nothing more than a link to this ticket, making it difficult for people to assist you. Try making a standalone discussion describing the problem you're facing and sharing any relevant information, like the way you have NetBox deployed/running.

Here on GitHub, the issues are used to track development efforts.

P.S. Try accessing your server using http://127.0.0.1:8000.