This repository was archived by the owner on Apr 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
Social Authentication and ContentTypes #43
Copy link
Copy link
Open
Description
Hi,
If you follow the doc about socialauth you will end up with a non working setup, at least when enabling google OAuth2
Traceback (most recent call last):
File "manage.py", line 28, in <module>
execute_from_command_line(sys.argv)
...
File "lib/python3.6/site-packages/social_django/urls.py", line 6, in <module>
from . import views
File "lib/python3.6/site-packages/social_django/views.py", line 10, in <module>
from .utils import psa
File "lib/python3.6/site-packages/social_django/utils.py", line 18, in <module>
Strategy = module_member(STRATEGY)
File "lib/python3.6/site-packages/social_core/utils.py", line 61, in module_member
module = import_module(mod)
File "lib/python3.6/site-packages/social_core/utils.py", line 55, in import_module
__import__(name)
File "lib/python3.6/site-packages/social_django/strategy.py", line 5, in <module>
from django.contrib.contenttypes.models import ContentType
File "lib/python3.6/site-packages/django/contrib/contenttypes/models.py", line 134, in <module>
class ContentType(models.Model):
File "lib/python3.6/site-packages/django/db/models/base.py", line 95, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
The solution looks obvious: add contenttypes to INSTALLED_APPS. Which you could do in two forms:
- You see the error, you are an experienced Django developer so, after instantiating Site() you add:
INSTALLED_APPS += ('django.contrib.contenttypes',)
And you will be greeted with...
table_factory() failed for <class 'django.contrib.contenttypes.models.ContentType'>.
table_factory() failed for <class 'django.contrib.contenttypes.models.ContentType'>.
Only then will you think "hey, it's not a plugin, but maybe the right place to put it is Site.get_installed_apps, like: yield 'django.contrib.contenttypes'.
Now it works.
So, that page might explain that contenttypes is needed, and how to add it?
Metadata
Metadata
Assignees
Labels
No labels