Im trying to implement google authentication but I got the following error:
django.urls.exceptions.NoReverseMatch: 'social' is not a registered namespace
i have like this in my login.html:
<a href="{% url 'social:begin' 'google-oauth2' %}"> Sign in with Google</a>
I also added this in my setting.py
SOCIAL_AUTH_URL_NAMESPACE = 'social'
url.py
urlpatterns = [
path('admin/', admin.site.urls),
path('register/', user_views.register, name='register'),
path('profile/', user_views.profile, name='profile'),
path('login/', auth_views.LoginView.as_view(template_name='users/login.html'), name='login'),
path('login/', include('allauth.urls')),
path('logout/', auth_views.LogoutView.as_view(template_name='users/logout.html'), name='logout'),
path('', include('blog.urls')),
]
Does anyone know how to solve this?
CodePudding user response:
Try this:
<a href="{% url 'begin' 'google-oauth2' %}"> Sign in with Google</a>
CodePudding user response:
Add the following in urls.py where the url with namespace 'begin' has been defined, before url pattern
app_name = 'social'
