Python social-auth-app-django 'social' is not a registered namespace

Multi tool use
Multi tool use








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











share|improve this question



























    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











    share|improve this question

























      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











      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 13:02

























      asked Nov 8 at 12:56









      Abdul Rehman

      854320




      854320






















          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






          share|improve this answer




















          • 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










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          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






























          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






          share|improve this answer




















          • 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














          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






          share|improve this answer




















          • 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












          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






          share|improve this answer












          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







          share|improve this answer












          share|improve this answer



          share|improve this answer










          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
















          • 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

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          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














































































          u,T2Gwa,gQykXk,hVWLd2B6lsr4eYarTQjFy v3W4NFW6oYu9h,Kv5kokTb5dhnVDmGin9R
          jC6Fj9PGj biu1eIxkV64

          Popular posts from this blog

          Old paper Canadian currency

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế