Python social-auth-app-django 'social' is not a registered namespace
up vote
0
down vote
favorite
I'm working on a project with Python(3.6) and Django(2.0) in which I'm trying to integrate social login by using social-auth-app-django
package.
Managing users in the users
app.
Here's my configurations:
From settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users',
'phone_field',
'social_django',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'social_django.middleware.SocialAuthExceptionMiddleware',
]
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR, 'templates'],
'APP_DIRS': True,
'OPTIONS':
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends', # <- Here
'social_django.context_processors.login_redirect',
],
,
,
]
LOGIN_URL = 'users/login/'
AUTHENTICATION_BACKENDS = (
'social_core.backends.open_id.OpenIdAuth', # for Google authentication
'social_core.backends.google.GoogleOpenId', # for Google authentication
'social_core.backends.google.GoogleOAuth2', # for Google authentication
'social_core.backends.linkedin.LinkedinOAuth2', # for Github authentication
'social_core.backends.facebook.FacebookOAuth2', # for Facebook authentication
'django.contrib.auth.backends.ModelBackend',
)
From users/urls.py:
app_name = 'users'
urlpatterns = [
path('signup/', views.SignUpView.as_view(), name='signup'),
path('login/', views.LoginView.as_view(), name='login'),
path('logout/', views.LogoutView.as_view(), name='logout'),
url(r'^activate/(?P<uidb64>[0-9A-Za-z_-]+)/(?P<token>[0-9A-Za-z]1,13-[0-9A-Za-z]1,20)/$',
views.activate, name='activate'),
url(r'^auth/', include('social_django.urls', namespace='social')),
]
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
From login.html:
<div class="col-lg-12 center-aligned">
<div style="margin: auto">
<div class="or-seperator"><b>or</b></div>
<div class="social-btn text-center">
<a href="% url 'social:begin' 'facebook-oauth2' %" class="btn btn-primary btn-lg" title="Facebook"><i class="fa fa-facebook"></i></a>
<a href="% url 'social_django.urls.url' %" class="btn btn-info btn-lg" title="LinkedIn"><i class="fa fa-linkedin"></i></a>
<a href="% url 'social:begin' 'google-oauth2' %" class="btn btn-danger btn-lg" title="Google"><i class="fa fa-google"></i></a>
</div>
</div>
</div>
When I load the login
template it returns an error as:
Exception Type: NoReverseMatch
Exception Value:
'social' is not a registered namespace
python django python-3.x python-social-auth django-2.0
add a comment |
up vote
0
down vote
favorite
I'm working on a project with Python(3.6) and Django(2.0) in which I'm trying to integrate social login by using social-auth-app-django
package.
Managing users in the users
app.
Here's my configurations:
From settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users',
'phone_field',
'social_django',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'social_django.middleware.SocialAuthExceptionMiddleware',
]
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR, 'templates'],
'APP_DIRS': True,
'OPTIONS':
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends', # <- Here
'social_django.context_processors.login_redirect',
],
,
,
]
LOGIN_URL = 'users/login/'
AUTHENTICATION_BACKENDS = (
'social_core.backends.open_id.OpenIdAuth', # for Google authentication
'social_core.backends.google.GoogleOpenId', # for Google authentication
'social_core.backends.google.GoogleOAuth2', # for Google authentication
'social_core.backends.linkedin.LinkedinOAuth2', # for Github authentication
'social_core.backends.facebook.FacebookOAuth2', # for Facebook authentication
'django.contrib.auth.backends.ModelBackend',
)
From users/urls.py:
app_name = 'users'
urlpatterns = [
path('signup/', views.SignUpView.as_view(), name='signup'),
path('login/', views.LoginView.as_view(), name='login'),
path('logout/', views.LogoutView.as_view(), name='logout'),
url(r'^activate/(?P<uidb64>[0-9A-Za-z_-]+)/(?P<token>[0-9A-Za-z]1,13-[0-9A-Za-z]1,20)/$',
views.activate, name='activate'),
url(r'^auth/', include('social_django.urls', namespace='social')),
]
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
From login.html:
<div class="col-lg-12 center-aligned">
<div style="margin: auto">
<div class="or-seperator"><b>or</b></div>
<div class="social-btn text-center">
<a href="% url 'social:begin' 'facebook-oauth2' %" class="btn btn-primary btn-lg" title="Facebook"><i class="fa fa-facebook"></i></a>
<a href="% url 'social_django.urls.url' %" class="btn btn-info btn-lg" title="LinkedIn"><i class="fa fa-linkedin"></i></a>
<a href="% url 'social:begin' 'google-oauth2' %" class="btn btn-danger btn-lg" title="Google"><i class="fa fa-google"></i></a>
</div>
</div>
</div>
When I load the login
template it returns an error as:
Exception Type: NoReverseMatch
Exception Value:
'social' is not a registered namespace
python django python-3.x python-social-auth django-2.0
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm working on a project with Python(3.6) and Django(2.0) in which I'm trying to integrate social login by using social-auth-app-django
package.
Managing users in the users
app.
Here's my configurations:
From settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users',
'phone_field',
'social_django',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'social_django.middleware.SocialAuthExceptionMiddleware',
]
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR, 'templates'],
'APP_DIRS': True,
'OPTIONS':
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends', # <- Here
'social_django.context_processors.login_redirect',
],
,
,
]
LOGIN_URL = 'users/login/'
AUTHENTICATION_BACKENDS = (
'social_core.backends.open_id.OpenIdAuth', # for Google authentication
'social_core.backends.google.GoogleOpenId', # for Google authentication
'social_core.backends.google.GoogleOAuth2', # for Google authentication
'social_core.backends.linkedin.LinkedinOAuth2', # for Github authentication
'social_core.backends.facebook.FacebookOAuth2', # for Facebook authentication
'django.contrib.auth.backends.ModelBackend',
)
From users/urls.py:
app_name = 'users'
urlpatterns = [
path('signup/', views.SignUpView.as_view(), name='signup'),
path('login/', views.LoginView.as_view(), name='login'),
path('logout/', views.LogoutView.as_view(), name='logout'),
url(r'^activate/(?P<uidb64>[0-9A-Za-z_-]+)/(?P<token>[0-9A-Za-z]1,13-[0-9A-Za-z]1,20)/$',
views.activate, name='activate'),
url(r'^auth/', include('social_django.urls', namespace='social')),
]
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
From login.html:
<div class="col-lg-12 center-aligned">
<div style="margin: auto">
<div class="or-seperator"><b>or</b></div>
<div class="social-btn text-center">
<a href="% url 'social:begin' 'facebook-oauth2' %" class="btn btn-primary btn-lg" title="Facebook"><i class="fa fa-facebook"></i></a>
<a href="% url 'social_django.urls.url' %" class="btn btn-info btn-lg" title="LinkedIn"><i class="fa fa-linkedin"></i></a>
<a href="% url 'social:begin' 'google-oauth2' %" class="btn btn-danger btn-lg" title="Google"><i class="fa fa-google"></i></a>
</div>
</div>
</div>
When I load the login
template it returns an error as:
Exception Type: NoReverseMatch
Exception Value:
'social' is not a registered namespace
python django python-3.x python-social-auth django-2.0
I'm working on a project with Python(3.6) and Django(2.0) in which I'm trying to integrate social login by using social-auth-app-django
package.
Managing users in the users
app.
Here's my configurations:
From settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users',
'phone_field',
'social_django',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'social_django.middleware.SocialAuthExceptionMiddleware',
]
TEMPLATES = [
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR, 'templates'],
'APP_DIRS': True,
'OPTIONS':
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'social_django.context_processors.backends', # <- Here
'social_django.context_processors.login_redirect',
],
,
,
]
LOGIN_URL = 'users/login/'
AUTHENTICATION_BACKENDS = (
'social_core.backends.open_id.OpenIdAuth', # for Google authentication
'social_core.backends.google.GoogleOpenId', # for Google authentication
'social_core.backends.google.GoogleOAuth2', # for Google authentication
'social_core.backends.linkedin.LinkedinOAuth2', # for Github authentication
'social_core.backends.facebook.FacebookOAuth2', # for Facebook authentication
'django.contrib.auth.backends.ModelBackend',
)
From users/urls.py:
app_name = 'users'
urlpatterns = [
path('signup/', views.SignUpView.as_view(), name='signup'),
path('login/', views.LoginView.as_view(), name='login'),
path('logout/', views.LogoutView.as_view(), name='logout'),
url(r'^activate/(?P<uidb64>[0-9A-Za-z_-]+)/(?P<token>[0-9A-Za-z]1,13-[0-9A-Za-z]1,20)/$',
views.activate, name='activate'),
url(r'^auth/', include('social_django.urls', namespace='social')),
]
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
From login.html:
<div class="col-lg-12 center-aligned">
<div style="margin: auto">
<div class="or-seperator"><b>or</b></div>
<div class="social-btn text-center">
<a href="% url 'social:begin' 'facebook-oauth2' %" class="btn btn-primary btn-lg" title="Facebook"><i class="fa fa-facebook"></i></a>
<a href="% url 'social_django.urls.url' %" class="btn btn-info btn-lg" title="LinkedIn"><i class="fa fa-linkedin"></i></a>
<a href="% url 'social:begin' 'google-oauth2' %" class="btn btn-danger btn-lg" title="Google"><i class="fa fa-google"></i></a>
</div>
</div>
</div>
When I load the login
template it returns an error as:
Exception Type: NoReverseMatch
Exception Value:
'social' is not a registered namespace
python django python-3.x python-social-auth django-2.0
python django python-3.x python-social-auth django-2.0
edited Nov 8 at 13:02
asked Nov 8 at 12:56
Abdul Rehman
854320
854320
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
According to the docs
urlpatterns = patterns('',
...
url('', include('social_django.urls', namespace='social'))
...
)
and more important:
SOCIAL_AUTH_URL_NAMESPACE = 'social'
while you have
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
Also consider that SOCIAL_AUTH_URL_NAMESPACE must be written in settings.py
, not in urls.py
How can I use it inside my login template? Because in this way, it says'social' is not a registered namespace
– Abdul Rehman
Nov 9 at 5:08
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
According to the docs
urlpatterns = patterns('',
...
url('', include('social_django.urls', namespace='social'))
...
)
and more important:
SOCIAL_AUTH_URL_NAMESPACE = 'social'
while you have
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
Also consider that SOCIAL_AUTH_URL_NAMESPACE must be written in settings.py
, not in urls.py
How can I use it inside my login template? Because in this way, it says'social' is not a registered namespace
– Abdul Rehman
Nov 9 at 5:08
add a comment |
up vote
0
down vote
According to the docs
urlpatterns = patterns('',
...
url('', include('social_django.urls', namespace='social'))
...
)
and more important:
SOCIAL_AUTH_URL_NAMESPACE = 'social'
while you have
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
Also consider that SOCIAL_AUTH_URL_NAMESPACE must be written in settings.py
, not in urls.py
How can I use it inside my login template? Because in this way, it says'social' is not a registered namespace
– Abdul Rehman
Nov 9 at 5:08
add a comment |
up vote
0
down vote
up vote
0
down vote
According to the docs
urlpatterns = patterns('',
...
url('', include('social_django.urls', namespace='social'))
...
)
and more important:
SOCIAL_AUTH_URL_NAMESPACE = 'social'
while you have
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
Also consider that SOCIAL_AUTH_URL_NAMESPACE must be written in settings.py
, not in urls.py
According to the docs
urlpatterns = patterns('',
...
url('', include('social_django.urls', namespace='social'))
...
)
and more important:
SOCIAL_AUTH_URL_NAMESPACE = 'social'
while you have
SOCIAL_AUTH_URL_NAMESPACE = "users:social"
Also consider that SOCIAL_AUTH_URL_NAMESPACE must be written in settings.py
, not in urls.py
answered Nov 8 at 15:01
shalakhin
1,60531523
1,60531523
How can I use it inside my login template? Because in this way, it says'social' is not a registered namespace
– Abdul Rehman
Nov 9 at 5:08
add a comment |
How can I use it inside my login template? Because in this way, it says'social' is not a registered namespace
– Abdul Rehman
Nov 9 at 5:08
How can I use it inside my login template? Because in this way, it says
'social' is not a registered namespace
– Abdul Rehman
Nov 9 at 5:08
How can I use it inside my login template? Because in this way, it says
'social' is not a registered namespace
– Abdul Rehman
Nov 9 at 5:08
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53208212%2fpython-social-auth-app-django-social-is-not-a-registered-namespace%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password