'Where is page social_django.views.auth?
I'm trying to make auth with google. But get
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/account/login/google/
Raised by: social_django.views.auth
Backend not found
settings.py
INSTALLED_APPS = [
...,
'social_django',
]
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '...'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '...'
SOCIAL_AUTH_URL_NAMESPACE = 'social'
urls.py(root)
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('books.urls')),
path('account/', include('account.urls')),
path('comments/', include('django_comments.urls')),
path('account/', include('social_django.urls', namespace='social'))
]
login.html
<a href="{% url "social:begin" "google" %}">Login with Google</a>
I did migrations for social_django
Solution 1:[1]
Instead of using :
<a href="{% url "social:begin" "**google**" %}">
Login with Google
</a>
Use:
< a href="{% url 'social:begin' '**google-oauth2**' %}?next={{ request.path }}">
Login with Google
</a>
Source : official documentation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Matt Seymour |
