Upgrading from 1.9.3 to 2.0.8 breaks #1077

Closed
opened 2025-12-29 16:28:35 +01:00 by adam · 7 comments
Owner

Originally created by @loganbest on GitHub (Jul 6, 2017).

Issue type: bug report

Python version: Python 2.7.12 & 3.5.2
NetBox version: 2.0.8

I followed the same upgrade procedure I normally do.

cd /opt/netbox
git checkout master
git pull origin master
supervisorctl restart netbox

After doing this I got an immediate "spawn error" in supervisor. Looking at the logs I found this:
ImportError: No module named corsheaders

I noticed the python 3 version of django-cors-headers was installed per the requirements.txt, but python 2 version wasn't. So I installed the 2 version and then gunicorn would start. Now I'm running into a new issue:

==> /var/log/supervisor/netbox-stderr---supervisor-0Rnpli.log <==
[2017-07-06 12:02:26 +0000] [1850] [ERROR] Socket error processing request.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 130, in handle
    self.handle_request(listener, req, client, addr)
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 187, in handle_request
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 171, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 170, in __call__
    response = self.get_response(request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 124, in get_response
    response = self._middleware_chain(request)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 44, in inner
    response = response_for_exception(request, exc)
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 94, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 132, in handle_uncaught_exception
    extra={'status_code': 500, 'request': request},
  File "/usr/lib/python2.7/logging/__init__.py", line 1193, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1286, in _log
    self.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1296, in handle
    self.callHandlers(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 1336, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python2.7/logging/__init__.py", line 759, in handle
    self.emit(record)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 121, in emit
    self.send_mail(subject, message, fail_silently=True, html_message=html_message)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 124, in send_mail
    mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/__init__.py", line 103, in mail_admins
    mail.send(fail_silently=fail_silently)
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", line 342, in send
    return self.get_connection(fail_silently).send_messages([self])
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 100, in send_messages
    new_conn_created = self.open()
  File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 58, in open
    self.connection = connection_class(self.host, self.port, **connection_params)
  File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/lib/python2.7/smtplib.py", line 316, in connect
    self.sock = self._get_socket(host, port, self.timeout)
  File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
    return socket.create_connection((host, port), timeout)
  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err
error: [Errno 111] Connection refused
Originally created by @loganbest on GitHub (Jul 6, 2017). ### Issue type: bug report **Python version:** Python 2.7.12 & 3.5.2 **NetBox version:** 2.0.8 I followed the same upgrade procedure I normally do. ```bash cd /opt/netbox git checkout master git pull origin master supervisorctl restart netbox ``` After doing this I got an immediate "spawn error" in supervisor. Looking at the logs I found this: `ImportError: No module named corsheaders` I noticed the python 3 version of django-cors-headers was installed per the requirements.txt, but python 2 version wasn't. So I installed the 2 version and then gunicorn would start. Now I'm running into a new issue: ```bash ==> /var/log/supervisor/netbox-stderr---supervisor-0Rnpli.log <== [2017-07-06 12:02:26 +0000] [1850] [ERROR] Socket error processing request. Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 130, in handle self.handle_request(listener, req, client, addr) File "/usr/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 187, in handle_request six.reraise(exc_info[0], exc_info[1], exc_info[2]) File "/usr/lib/python2.7/dist-packages/gunicorn/workers/sync.py", line 171, in handle_request respiter = self.wsgi(environ, resp.start_response) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 170, in __call__ response = self.get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 124, in get_response response = self._middleware_chain(request) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 44, in inner response = response_for_exception(request, exc) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 94, in response_for_exception response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info()) File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 132, in handle_uncaught_exception extra={'status_code': 500, 'request': request}, File "/usr/lib/python2.7/logging/__init__.py", line 1193, in error self._log(ERROR, msg, args, **kwargs) File "/usr/lib/python2.7/logging/__init__.py", line 1286, in _log self.handle(record) File "/usr/lib/python2.7/logging/__init__.py", line 1296, in handle self.callHandlers(record) File "/usr/lib/python2.7/logging/__init__.py", line 1336, in callHandlers hdlr.handle(record) File "/usr/lib/python2.7/logging/__init__.py", line 759, in handle self.emit(record) File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 121, in emit self.send_mail(subject, message, fail_silently=True, html_message=html_message) File "/usr/local/lib/python2.7/dist-packages/django/utils/log.py", line 124, in send_mail mail.mail_admins(subject, message, *args, connection=self.connection(), **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/core/mail/__init__.py", line 103, in mail_admins mail.send(fail_silently=fail_silently) File "/usr/local/lib/python2.7/dist-packages/django/core/mail/message.py", line 342, in send return self.get_connection(fail_silently).send_messages([self]) File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 100, in send_messages new_conn_created = self.open() File "/usr/local/lib/python2.7/dist-packages/django/core/mail/backends/smtp.py", line 58, in open self.connection = connection_class(self.host, self.port, **connection_params) File "/usr/lib/python2.7/smtplib.py", line 256, in __init__ (code, msg) = self.connect(host, port) File "/usr/lib/python2.7/smtplib.py", line 316, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket return socket.create_connection((host, port), timeout) File "/usr/lib/python2.7/socket.py", line 575, in create_connection raise err error: [Errno 111] Connection refused ```
adam closed this issue 2025-12-29 16:28:35 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 6, 2017):

Looks like it failed to send an error email. Try running it with DEBUG=True in configuration.py.

@jeremystretch commented on GitHub (Jul 6, 2017): Looks like it failed to send an error email. Try running it with `DEBUG=True` in configuration.py.
Author
Owner

@loganbest commented on GitHub (Jul 6, 2017):

I restored my VM and did the upgrade again but without upgrading system packages first. It ran the first time (after installing django-cors-headers for py2). This time it ran, but any requests get tracebacks like this:


==> /var/log/supervisor/netbox-stderr---supervisor-f1_8aJ.log <==
Internal Server Error: /dcim/devices/486/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner
    response = get_response(request)
  File "/opt/netbox/netbox/utilities/middleware.py", line 37, in __call__
    api_path = reverse('api-root')
  File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py", line 91, in reverse
    return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 344, in _reverse_with_prefix
    self._populate()
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 196, in _populate
    for pattern in reversed(self.url_patterns):
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/netbox/urls.py", line 3, in <module>
    from rest_framework_swagger.views import get_swagger_view
ImportError: cannot import name get_swagger_view
Internal Server Error: /dcim/devices/486/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner
    response = get_response(request)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/deprecation.py", line 138, in __call__
    response = self.process_response(request, response)
  File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/middleware.py", line 129, in process_response
    panel.generate_stats(request, response)
  File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/panels/request.py", line 45, in generate_stats
    match = resolve(request.path)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py", line 27, in resolve
    return get_resolver(urlconf).resolve(path)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 270, in resolve
    for pattern in self.url_patterns:
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/netbox/urls.py", line 3, in <module>
    from rest_framework_swagger.views import get_swagger_view
ImportError: cannot import name get_swagger_view
Internal Server Error: /
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner
    response = get_response(request)
  File "/opt/netbox/netbox/utilities/middleware.py", line 37, in __call__
    api_path = reverse('api-root')
  File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py", line 91, in reverse
    return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 344, in _reverse_with_prefix
    self._populate()
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 196, in _populate
    for pattern in reversed(self.url_patterns):
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/netbox/urls.py", line 3, in <module>
    from rest_framework_swagger.views import get_swagger_view
ImportError: cannot import name get_swagger_view
Internal Server Error: /
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner
    response = get_response(request)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/deprecation.py", line 138, in __call__
    response = self.process_response(request, response)
  File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/middleware.py", line 129, in process_response
    panel.generate_stats(request, response)
  File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/panels/request.py", line 45, in generate_stats
    match = resolve(request.path)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py", line 27, in resolve
    return get_resolver(urlconf).resolve(path)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 270, in resolve
    for pattern in self.url_patterns:
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/netbox/urls.py", line 3, in <module>
    from rest_framework_swagger.views import get_swagger_view
ImportError: cannot import name get_swagger_view
@loganbest commented on GitHub (Jul 6, 2017): I restored my VM and did the upgrade again but without upgrading system packages first. It ran the first time (after installing django-cors-headers for py2). This time it ran, but any requests get tracebacks like this: ```bash ==> /var/log/supervisor/netbox-stderr---supervisor-f1_8aJ.log <== Internal Server Error: /dcim/devices/486/ Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner response = get_response(request) File "/opt/netbox/netbox/utilities/middleware.py", line 37, in __call__ api_path = reverse('api-root') File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py", line 91, in reverse return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 344, in _reverse_with_prefix self._populate() File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 196, in _populate for pattern in reversed(self.url_patterns): File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/netbox/netbox/netbox/urls.py", line 3, in <module> from rest_framework_swagger.views import get_swagger_view ImportError: cannot import name get_swagger_view Internal Server Error: /dcim/devices/486/ Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner response = get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/utils/deprecation.py", line 138, in __call__ response = self.process_response(request, response) File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/middleware.py", line 129, in process_response panel.generate_stats(request, response) File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/panels/request.py", line 45, in generate_stats match = resolve(request.path) File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py", line 27, in resolve return get_resolver(urlconf).resolve(path) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 270, in resolve for pattern in self.url_patterns: File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/netbox/netbox/netbox/urls.py", line 3, in <module> from rest_framework_swagger.views import get_swagger_view ImportError: cannot import name get_swagger_view Internal Server Error: / Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner response = get_response(request) File "/opt/netbox/netbox/utilities/middleware.py", line 37, in __call__ api_path = reverse('api-root') File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py", line 91, in reverse return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 344, in _reverse_with_prefix self._populate() File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 196, in _populate for pattern in reversed(self.url_patterns): File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/netbox/netbox/netbox/urls.py", line 3, in <module> from rest_framework_swagger.views import get_swagger_view ImportError: cannot import name get_swagger_view Internal Server Error: / Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py", line 42, in inner response = get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/utils/deprecation.py", line 138, in __call__ response = self.process_response(request, response) File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/middleware.py", line 129, in process_response panel.generate_stats(request, response) File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/panels/request.py", line 45, in generate_stats match = resolve(request.path) File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py", line 27, in resolve return get_resolver(urlconf).resolve(path) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 270, in resolve for pattern in self.url_patterns: File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 313, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 306, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/netbox/netbox/netbox/urls.py", line 3, in <module> from rest_framework_swagger.views import get_swagger_view ImportError: cannot import name get_swagger_view ```
Author
Owner

@loganbest commented on GitHub (Jul 6, 2017):

Here's the copy/paste from the web error page too

Environment:


Request Method: GET
Request URL: https://netbox.example.com/

Django Version: 1.10.6
Python Version: 2.7.12
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_tables2',
 'mptt',
 'rest_framework',
 'rest_framework_swagger',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'secrets',
 'tenancy',
 'users',
 'utilities')
Installed Middleware:
('debug_toolbar.middleware.DebugToolbarMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'utilities.middleware.LoginRequiredMiddleware',
 'utilities.middleware.APIVersionMiddleware')



Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
  42.             response = get_response(request)

File "/usr/local/lib/python2.7/dist-packages/django/utils/deprecation.py" in __call__
  138.             response = self.process_response(request, response)

File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/middleware.py" in process_response
  129.                 panel.generate_stats(request, response)

File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/panels/request.py" in generate_stats
  45.             match = resolve(request.path)

File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py" in resolve
  27.     return get_resolver(urlconf).resolve(path)

File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py" in resolve
  270.             for pattern in self.url_patterns:

File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in __get__
  35.         res = instance.__dict__[self.name] = self.func(instance)

File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py" in url_patterns
  313.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in __get__
  35.         res = instance.__dict__[self.name] = self.func(instance)

File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py" in urlconf_module
  306.             return import_module(self.urlconf_name)

File "/usr/lib/python2.7/importlib/__init__.py" in import_module
  37.     __import__(name)

File "/opt/netbox/netbox/netbox/urls.py" in <module>
  3. from rest_framework_swagger.views import get_swagger_view

Exception Type: ImportError at /
Exception Value: cannot import name get_swagger_view
@loganbest commented on GitHub (Jul 6, 2017): Here's the copy/paste from the web error page too ```bash Environment: Request Method: GET Request URL: https://netbox.example.com/ Django Version: 1.10.6 Python Version: 2.7.12 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'corsheaders', 'debug_toolbar', 'django_filters', 'django_tables2', 'mptt', 'rest_framework', 'rest_framework_swagger', 'circuits', 'dcim', 'ipam', 'extras', 'secrets', 'tenancy', 'users', 'utilities') Installed Middleware: ('debug_toolbar.middleware.DebugToolbarMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'utilities.middleware.LoginRequiredMiddleware', 'utilities.middleware.APIVersionMiddleware') Traceback: File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner 42. response = get_response(request) File "/usr/local/lib/python2.7/dist-packages/django/utils/deprecation.py" in __call__ 138. response = self.process_response(request, response) File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/middleware.py" in process_response 129. panel.generate_stats(request, response) File "/usr/local/lib/python2.7/dist-packages/debug_toolbar/panels/request.py" in generate_stats 45. match = resolve(request.path) File "/usr/local/lib/python2.7/dist-packages/django/urls/base.py" in resolve 27. return get_resolver(urlconf).resolve(path) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py" in resolve 270. for pattern in self.url_patterns: File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in __get__ 35. res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py" in url_patterns 313. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in __get__ 35. res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py" in urlconf_module 306. return import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py" in import_module 37. __import__(name) File "/opt/netbox/netbox/netbox/urls.py" in <module> 3. from rest_framework_swagger.views import get_swagger_view Exception Type: ImportError at / Exception Value: cannot import name get_swagger_view ```
Author
Owner

@jeremystretch commented on GitHub (Jul 6, 2017):

What is the output of pip freeze?

@jeremystretch commented on GitHub (Jul 6, 2017): What is the output of `pip freeze`?
Author
Owner

@loganbest commented on GitHub (Jul 6, 2017):

Provided for both py versions just in case

root@netbox:/opt/netbox# pip freeze
acme==0.10.2
appdirs==1.4.3
asn1crypto==0.22.0
attrs==15.2.0
certbot==0.10.2
cffi==1.10.0
chardet==2.3.0
ConfigArgParse==0.11.0
configobj==5.0.6
cryptography==1.8.1
Django==1.10.6
django-cors-headers==2.1.0
django-debug-toolbar==1.7
django-filter==1.0.2
django-mptt==0.8.7
django-rest-swagger==0.3.10
django-tables2==1.4.2
djangorestframework==3.6.2
dnspython==1.15.0
enum34==1.1.6
funcsigs==1.0.2
graphviz==0.6
gunicorn==19.4.5
idna==2.5
ipaddress==1.0.18
Landscape-Client==16.3+bzr834
lxml==3.7.3
Markdown==2.6.8
meld3==1.0.2
mock==2.0.0
natsort==5.0.2
ncclient==0.5.2
ndg-httpsclient==0.4.0
netaddr==0.7.18
packaging==16.8
PAM==0.4.2
paramiko==2.1.2
parsedatetime==1.4
pbr==1.8.0
psutil==4.1.0
psycopg2==2.7.1
py-gfm==0.1.3
pyasn1==0.2.3
pyasn1-modules==0.0.7
pycparser==2.17
pycrypto==2.6.1
PyICU==1.9.2
pyOpenSSL==0.15.1
pyparsing==2.2.0
pyRFC3339==1.0
pyserial==3.0.1
python-apt==1.1.0b1
python-debian==0.1.27
pytz==2014.10
PyYAML==3.12
requests==2.9.1
service-identity==16.0.0
six==1.10.0
sqlparse==0.2.3
supervisor==3.2.0
Twisted==16.0.0
urllib3==1.13.1
virtualenv==15.0.1
xmltodict==0.10.2
zope.component==4.2.2
zope.event==4.2.0
zope.hookable==4.0.4
zope.interface==4.1.3
root@netbox:/opt/netbox# pip3 freeze
asn1crypto==0.22.0
bcrypt==3.1.3
blinker==1.3
certifi==2017.4.17
cffi==1.10.0
chardet==3.0.4
cloud-init==0.7.9
command-not-found==0.3
configobj==5.0.6
coreapi==2.3.1
coreschema==0.0.4
cryptography==1.9
Django==1.11.3
django-cors-headers==2.1.0
django-debug-toolbar==1.8
django-filter==1.0.4
django-mptt==0.8.7
django-rest-swagger==2.1.2
django-tables2==1.10.0
djangorestframework==3.6.3
graphviz==0.8
idna==2.5
itypes==1.1.0
Jinja2==2.9.6
jsonpatch==1.10
jsonpointer==1.9
language-selector==0.1
lxml==3.8.0
Markdown==2.6.8
MarkupSafe==1.0
natsort==5.0.3
ncclient==0.5.3
netaddr==0.7.18
oauthlib==1.0.3
olefile==0.44
openapi-codec==1.3.1
paramiko==2.2.1
Pillow==4.2.0
prettytable==0.7.2
psycopg2==2.7.1
py-gfm==0.1.3
pyasn1==0.2.3
pycparser==2.18
pycrypto==2.6.1
pycurl==7.43.0
pygobject==3.20.0
PyJWT==1.3.0
PyNaCl==1.1.2
pyserial==3.0.1
python-apt==1.1.0b1
python-debian==0.1.27
python-systemd==231
pytz==2017.2
PyYAML==3.11
requests==2.18.1
simplejson==3.11.1
six==1.10.0
sqlparse==0.2.3
ssh-import-id==5.5
ufw==0.35
unattended-upgrades==0.1
uritemplate==3.0.0
urllib3==1.21.1
virtualenv==15.0.1
xmltodict==0.11.0
@loganbest commented on GitHub (Jul 6, 2017): Provided for both py versions just in case ```bash root@netbox:/opt/netbox# pip freeze acme==0.10.2 appdirs==1.4.3 asn1crypto==0.22.0 attrs==15.2.0 certbot==0.10.2 cffi==1.10.0 chardet==2.3.0 ConfigArgParse==0.11.0 configobj==5.0.6 cryptography==1.8.1 Django==1.10.6 django-cors-headers==2.1.0 django-debug-toolbar==1.7 django-filter==1.0.2 django-mptt==0.8.7 django-rest-swagger==0.3.10 django-tables2==1.4.2 djangorestframework==3.6.2 dnspython==1.15.0 enum34==1.1.6 funcsigs==1.0.2 graphviz==0.6 gunicorn==19.4.5 idna==2.5 ipaddress==1.0.18 Landscape-Client==16.3+bzr834 lxml==3.7.3 Markdown==2.6.8 meld3==1.0.2 mock==2.0.0 natsort==5.0.2 ncclient==0.5.2 ndg-httpsclient==0.4.0 netaddr==0.7.18 packaging==16.8 PAM==0.4.2 paramiko==2.1.2 parsedatetime==1.4 pbr==1.8.0 psutil==4.1.0 psycopg2==2.7.1 py-gfm==0.1.3 pyasn1==0.2.3 pyasn1-modules==0.0.7 pycparser==2.17 pycrypto==2.6.1 PyICU==1.9.2 pyOpenSSL==0.15.1 pyparsing==2.2.0 pyRFC3339==1.0 pyserial==3.0.1 python-apt==1.1.0b1 python-debian==0.1.27 pytz==2014.10 PyYAML==3.12 requests==2.9.1 service-identity==16.0.0 six==1.10.0 sqlparse==0.2.3 supervisor==3.2.0 Twisted==16.0.0 urllib3==1.13.1 virtualenv==15.0.1 xmltodict==0.10.2 zope.component==4.2.2 zope.event==4.2.0 zope.hookable==4.0.4 zope.interface==4.1.3 ``` ```bash root@netbox:/opt/netbox# pip3 freeze asn1crypto==0.22.0 bcrypt==3.1.3 blinker==1.3 certifi==2017.4.17 cffi==1.10.0 chardet==3.0.4 cloud-init==0.7.9 command-not-found==0.3 configobj==5.0.6 coreapi==2.3.1 coreschema==0.0.4 cryptography==1.9 Django==1.11.3 django-cors-headers==2.1.0 django-debug-toolbar==1.8 django-filter==1.0.4 django-mptt==0.8.7 django-rest-swagger==2.1.2 django-tables2==1.10.0 djangorestframework==3.6.3 graphviz==0.8 idna==2.5 itypes==1.1.0 Jinja2==2.9.6 jsonpatch==1.10 jsonpointer==1.9 language-selector==0.1 lxml==3.8.0 Markdown==2.6.8 MarkupSafe==1.0 natsort==5.0.3 ncclient==0.5.3 netaddr==0.7.18 oauthlib==1.0.3 olefile==0.44 openapi-codec==1.3.1 paramiko==2.2.1 Pillow==4.2.0 prettytable==0.7.2 psycopg2==2.7.1 py-gfm==0.1.3 pyasn1==0.2.3 pycparser==2.18 pycrypto==2.6.1 pycurl==7.43.0 pygobject==3.20.0 PyJWT==1.3.0 PyNaCl==1.1.2 pyserial==3.0.1 python-apt==1.1.0b1 python-debian==0.1.27 python-systemd==231 pytz==2017.2 PyYAML==3.11 requests==2.18.1 simplejson==3.11.1 six==1.10.0 sqlparse==0.2.3 ssh-import-id==5.5 ufw==0.35 unattended-upgrades==0.1 uritemplate==3.0.0 urllib3==1.21.1 virtualenv==15.0.1 xmltodict==0.11.0 ```
Author
Owner

@jeremystretch commented on GitHub (Jul 6, 2017):

You need to figure out whether you want to run NetBox on Python2 or Python3. I suggest Python3, but right now you're running it on Python2. The error is because you have an outdated version of django-rest-swagger installed. Run pip install -r requirements.txt to install the necessary packages.

I'm going to close out this issue as it's not a bug in NetBox, but if you need further assistance please post to the mailing list.

@jeremystretch commented on GitHub (Jul 6, 2017): You need to figure out whether you want to run NetBox on Python2 or Python3. I suggest Python3, but right now you're running it on Python2. The error is because you have an outdated version of `django-rest-swagger` installed. Run `pip install -r requirements.txt` to install the necessary packages. I'm going to close out this issue as it's not a bug in NetBox, but if you need further assistance please post to the [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss).
Author
Owner

@loganbest commented on GitHub (Jul 6, 2017):

I have to suggest a modification to your documentation then. You suggest using supervisor, which I absolutely support using but they don't support python3 yet (and no timeline for it). So I can't change my default /usr/bin/python to python3 and still use that. Can you clarify how you use python3 and supervisor or update the documentation with that?

@loganbest commented on GitHub (Jul 6, 2017): I have to suggest a modification to your documentation then. You suggest using supervisor, which I absolutely support using but they don't support python3 yet (and no timeline for it). So I can't change my default /usr/bin/python to python3 and still use that. Can you clarify how you use python3 and supervisor or update the documentation with that?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1077