Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No friendly message about removal of filtersets emitted. #4644

Closed
rgammans opened this issue Nov 1, 2016 · 4 comments
Closed

No friendly message about removal of filtersets emitted. #4644

rgammans opened this issue Nov 1, 2016 · 4 comments
Milestone

Comments

@rgammans
Copy link

rgammans commented Nov 1, 2016

I'm getting the following backtrace since 3.5.2 was released.

mod_wsgi (pid=107917): Exception occurred processing WSGI script '/my_project/my_app/deploy/my_app.wsgi'.
Traceback (most recent call last):
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/Django-1.8-py2.7.egg/django/core/handlers/wsgi.py", line 170, in __call__
    self.load_middleware()
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/Django-1.8-py2.7.egg/django/core/handlers/base.py", line 52, in load_middleware
    mw_instance = mw_class()
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/Django-1.8-py2.7.egg/django/middleware/locale.py", line 24, in __init__
    for url_pattern in get_resolver(None).url_patterns:
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/Django-1.8-py2.7.egg/django/core/urlresolvers.py", line 402, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/Django-1.8-py2.7.egg/django/core/urlresolvers.py", line 396, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "my_project/my_app/deploy/cgi/my_app/urls.py", line 7, in <module>
    from rest_framework import routers, serializers, viewsets
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/djangorestframework-3.5.2-py2.7.egg/rest_framework/viewsets.py", line 26, in <module>
    from rest_framework import generics, mixins, views
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/djangorestframework-3.5.2-py2.7.egg/rest_framework/generics.py", line 25, in <module>
    class GenericAPIView(views.APIView):
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/djangorestframework-3.5.2-py2.7.egg/rest_framework/generics.py", line 44, in GenericAPIView
    filter_backends = api_settings.DEFAULT_FILTER_BACKENDS
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/djangorestframework-3.5.2-py2.7.egg/rest_framework/settings.py", line 220, in __getattr__
    val = perform_import(val, attr)
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/djangorestframework-3.5.2-py2.7.egg/rest_framework/settings.py", line 165, in perform_import
    return [import_from_string(item, setting_name) for item in val]
  File "my_project/my_app/deploy/python-env/lib/python2.7/site-packages/djangorestframework-3.5.2-py2.7.egg/rest_framework/settings.py", line 181, in import_from_string
    raise ImportError(msg)
ImportError: Could not import 'rest_framework.filters.DjangoFilterBackend' for API setting 'DEFAULT_FILTER_BACKENDS'. ImportError: No module named rest_framework.filterset.

with

REST_FRAMEWORK = {
    'DEFAULT_FILTER_BACKENDS': (
        'rest_framework.filters.DjangoFilterBackend',
    ),
    'DEFAULT_PARSER_CLASSES': (
        'rest_framework.parsers.JSONParser',
    ),
    'DEFAULT_RENDERER_CLASSES' : [
        'rest_framework.renderers.JSONRenderer',
    ],
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAdminUser',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.SessionAuthentication',
    )

}

My reading of #4620 is that this should be a friendly warning pointing be to the direct issue. Instead I had to dig through the diff of pip freeze outputs to trace it down. No worries it's done now. BVUt it might help other later if your warning appears . ;-).

@tomchristie
Copy link
Member

:-/

@tomchristie
Copy link
Member

Related: #4643

@tomchristie tomchristie added this to the 3.5.3 Release milestone Nov 1, 2016
@njoyard
Copy link

njoyard commented Nov 2, 2016

As is, 3.5.1+ are not compatible with code written for 3.5.0. I get that this was a bugfix (or did I understand something wrong ?) but 3.5.1 should really be called 4.0.0, and so on. Getting an ImportError because you depend on "djangorestframework>=3.5,<3.6" is really bad semver practice :(

@tomchristie
Copy link
Member

It's not intentional. It's a bugfix causing a bug. We'll resolve it and issue a new release ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants