Closed jathanism closed 2 years ago
I added this to my nautobot_config.py file then restarted my containers. When I attempted to log in, I got this trace:
Environment:
Request Method: POST
Request URL: http://0.0.0.0:8080/login/
Django Version: 3.1.14
Python Version: 3.6.15
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'cacheops',
'corsheaders',
'django_filters',
'django_jinja',
'django_tables2',
'django_prometheus',
'mptt',
'rest_framework',
'social_django',
'taggit',
'timezone_field',
'nautobot.core.apps.NautobotServerConfig',
'nautobot.core',
'django.contrib.admin',
'django_celery_beat',
'db_file_storage',
'nautobot.circuits',
'nautobot.dcim',
'nautobot.ipam',
'nautobot.extras',
'nautobot.tenancy',
'nautobot.users',
'nautobot.utilities',
'nautobot.virtualization',
'django_rq',
'drf_yasg',
'graphene_django',
'health_check',
'health_check.cache',
'health_check.storage',
'django_extensions',
'constance.backends.database',
'debug_toolbar',
'dolt.NautobotDolt']
Installed 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',
'nautobot.core.middleware.ExceptionHandlingMiddleware',
'nautobot.core.middleware.RemoteUserMiddleware',
'nautobot.core.middleware.ExternalAuthMiddleware',
'nautobot.core.middleware.APIVersionMiddleware',
'nautobot.core.middleware.ObjectChangeMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware',
'dolt.middleware.dolt_health_check_intercept_middleware',
'dolt.middleware.DoltBranchMiddleware',
'dolt.middleware.DoltAutoCommitMiddleware']
Traceback (most recent call last):
The above exception (Error 99 connecting to localhost:6379. Cannot assign requested address.) was the direct cause of the following exception:
File "/usr/local/lib/python3.6/site-packages/django_redis/cache.py", line 27, in _decorator
return method(self, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django_redis/cache.py", line 131, in has_key
return self.client.has_key(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django_redis/client/default.py", line 511, in has_key
raise ConnectionInterrupted(connection=client) from e
During handling of the above exception (Redis ConnectionError: Error 99 connecting to localhost:6379. Cannot assign requested address.), another exception occurred:
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 171, in _get_response
response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/source/dolt/middleware.py", line 74, in process_view
return view_func(request, *view_args, **view_kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/decorators/debug.py", line 89, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/nautobot/users/views.py", line 40, in dispatch
return super().dispatch(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/nautobot/users/views.py", line 71, in post
auth_login(request, form.get_user())
File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/__init__.py", line 108, in login
request.session.cycle_key()
File "/usr/local/lib/python3.6/site-packages/django/contrib/sessions/backends/base.py", line 344, in cycle_key
self.create()
File "/usr/local/lib/python3.6/site-packages/django/contrib/sessions/backends/cache.py", line 43, in create
self._session_key = self._get_new_session_key()
File "/usr/local/lib/python3.6/site-packages/django/contrib/sessions/backends/base.py", line 196, in _get_new_session_key
if not self.exists(session_key):
File "/usr/local/lib/python3.6/site-packages/django/contrib/sessions/backends/cache.py", line 70, in exists
return bool(session_key) and (self.cache_key_prefix + session_key) in self._cache
File "/usr/local/lib/python3.6/site-packages/django/core/cache/backends/base.py", line 212, in __contains__
return self.has_key(key)
File "/usr/local/lib/python3.6/site-packages/django_redis/cache.py", line 34, in _decorator
raise e.__cause__
File "/usr/local/lib/python3.6/site-packages/django_redis/client/default.py", line 509, in has_key
return client.exists(key) == 1
File "/usr/local/lib/python3.6/site-packages/redis/commands/core.py", line 992, in exists
return self.execute_command('EXISTS', *names)
File "/usr/local/lib/python3.6/site-packages/redis/client.py", line 1068, in execute_command
conn = self.connection or pool.get_connection(command_name, **options)
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 1173, in get_connection
connection.connect()
File "/usr/local/lib/python3.6/site-packages/redis/connection.py", line 571, in connect
raise ConnectionError(self._error_message(e))
Exception Type: ConnectionError at /login/
Exception Value: Error 99 connecting to localhost:6379. Cannot assign requested address.
I then stopped the containers, removed the addition, started again, and login went fine.
Yeah, that wouldn't be the correct Redis URL for the container-based dev environment.
I updated the example to use parse_redis_connection(redis_database=3)
instead of a hard-coded URI.
nautobot_database_ready
signal