RealmTeam / django-rest-framework-social-oauth2

python-social-auth and oauth2 support for django-rest-framework
MIT License
1.06k stars 191 forks source link

Dependency on django-braces leads to import error: cannot import name 'six' from 'django.utils' #213

Open kohlab opened 4 years ago

kohlab commented 4 years ago

I'm not sure what change I made that led to this, but suddenly I can't start my Django server. It seems to be due to a dependency django-rest-framework-social-oauth2 has on the django-braces package, which hasn't been updated in so long it's not compatible with Python 3.7.

Any fixes, patches, or workarounds appreciated!

Exception in thread django-main-thread: Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 926, in _bootstrap_inner self.run() File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 870, in run self._target(*self._args, *self._kwargs) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(args, kwargs) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/core/management/base.py", line 395, in check include_deployment_checks=include_deployment_checks, File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/core/management/base.py", line 382, in _run_checks return checks.run_checks(kwargs) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config return check_resolver(resolver) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver return check_method() File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/urls/resolvers.py", line 406, in check for pattern in self.url_patterns: File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/utils/functional.py", line 48, in get res = instance.dict[self.name] = self.func(instance) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/urls/resolvers.py", line 587, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/utils/functional.py", line 48, in get res = instance.dict[self.name] = self.func(instance) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/urls/resolvers.py", line 580, in urlconf_module return import_module(self.urlconf_name) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/dylan/Dev/RideHare/server/ridehare/urls.py", line 28, in url(r'^api-auth/', include('rest_framework_social_oauth2.urls')), File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/urls/conf.py", line 34, in include urlconf_module = import_module(urlconf_module) File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/rest_framework_social_oauth2/urls.py", line 6, in from .views import ConvertTokenView, TokenView, RevokeTokenView, invalidate_sessions File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/rest_framework_social_oauth2/views.py", line 4, in from braces.views import CsrfExemptMixin File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/braces/views/init.py", line 3, in from ._access import ( File "/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/braces/views/_access.py", line 13, in from django.utils import six ImportError: cannot import name 'six' from 'django.utils' (/Users/dylan/.local/share/virtualenvs/server-2uc2X-TS/lib/python3.7/site-packages/django/utils/init.py)

sajeeshen commented 4 years ago

same with me, now I cant use this

kohlab commented 4 years ago

Ah, I see the issue. Django updated from 2.2 to 3.0 yesterday, and lots of stuff is breaking. I unwittingly "upgraded" by having django = "*" in my Pipfile. I've changed that to django = "2.2" so I can upgrade when all the packages I use are compatible.

So basically, this is a note to say we need 3.x compatibility. :-)

kohlab commented 4 years ago

(Sorry, I meant django = "==2.2".)

mizvyt commented 4 years ago

A fix for this has been integrated in the master branch already, I'll alert the maintainer to publish a new release.

@PhilipGarnero

kohlab commented 4 years ago

Great, thanks.

jcohen28 commented 4 years ago

Thank you for your proactive maintenance and support of the new Django release. Can you please share the timeline for when you plan to publish the release containing those fixes?

wagnerdelima commented 4 years ago

Hi all.

My team and I are constantly using this framework and it seems it has died out there. I contacted the owner by email asking if he would add some of us as maintainers so we could continue to improve it. However we didn't get a response.

I am publishing the project under my profile and we are going to continue to invest time in it.

So I would like to gently ask you to contribute to this project on: https://github.com/wagnerdelima/drf-social-oauth2

Thank you for understanding.