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

'module' object has no attribute 'oauth2' #98

Open
Alisa007 opened this issue Sep 13, 2014 · 7 comments
Open

'module' object has no attribute 'oauth2' #98

Alisa007 opened this issue Sep 13, 2014 · 7 comments

Comments

@Alisa007
Copy link

First of all. Thank you! This app would be very helpful if I could manage to make it work.
I try to add OAuth2 authentication scheme to Django rest framework. I'm following the documentation: http://www.django-rest-framework.org/api-guide/authentication It states that 'provider.oauth2' shall be added to INSTALLED_APPS. However, if I do that I keep getting the same error:

Traceback (most recent call last):
File "/Users/user/s/lib/python3.4/site-packages/django/apps/config.py", line 114, in create
cls = getattr(mod, cls_name)
AttributeError: 'module' object has no attribute 'oauth2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/user/PycharmProjects/s/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/Users/user/s/lib/python3.4/site-packages/django/core/management/init.py", line 385, in execute_from_command_line
utility.execute()
File "/Users/user/s/lib/python3.4/site-packages/django/core/management/init.py", line 354, in execute
django.setup()
File "/Users/user/s/lib/python3.4/site-packages/django/init.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/user/s/lib/python3.4/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/user/s/lib/python3.4/site-packages/django/apps/config.py", line 120, in create
"cannot import name '%s' from '%s'" % (cls_name, mod_path))
ImportError: cannot import name 'oauth2' from 'provider'

Process finished with exit code 1

@blag
Copy link

blag commented Oct 17, 2014

Which version of Django are you using? 1.7?

@amille44420
Copy link

I'm having the same error, I confirm be using Django 1.7 (with Python 3.4 too)

@blag
Copy link

blag commented Oct 23, 2014

I think this is running into this Django issue, and according to this comment, the documentation on app_label indicates that the fix is simply including an app_label on models defined in nested apps.

It looks like PR #93 is going to fix this in commit 4a5ba08. Hopefully CaffeineHit wakes up and merges the PR soon.

@johnlabarge
Copy link

Is there a work around for this?

@blag
Copy link

blag commented Feb 12, 2015

CaffeineHit appears to be completely dead, so this repository is no longer being updated.

So no, there is no workaround for this. If you can switch to a different OAuth 2 provider, you can use Django Oauth Toolkit.

There are forks that are still developed - I suggest either @mapmyfitness's fork or @glassresistor's fork.

@dbritos
Copy link

dbritos commented Sep 30, 2015

I have the same issue and i not use Django

@blag
Copy link

blag commented Oct 1, 2015

@dbritos: If you're sure you're not using Django, you may get that error if you are trying to use the python-oauth2 library instead, since there is an unfortunate module name collision between that project and this one.

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

5 participants