이전에 비슷한 질문이 있었지만 그 중 아무 것도 내 상황과 거의 같지 않은 것으로 알고 있습니다. I 나타나는 오류는 다음과 같습니다social_django를 통합 할 때 'social'이 등록 된 네임 스페이스가 아닙니다.
Environment:
Request Method: GET
Request URL: http://web/login/auth0
Django Version: 1.11
Python Version: 3.5.4
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'social_django',
'cx_benchmark.apps.authentication']
Installed 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']
Traceback:
File "/usr/local/lib/python3.5/site-packages/django/urls/base.py" in reverse
77. extra, resolver = resolver.namespace_dict[ns]
During handling of the above exception ('social'), another exception occurred:
File "/usr/local/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.5/site-packages/social_django/utils.py" in wrapper
37. uri = reverse(redirect_uri, args=(backend,))
File "/usr/local/lib/python3.5/site-packages/django/urls/base.py" in reverse
87. raise NoReverseMatch("%s is not a registered namespace" % key)
Exception Type: NoReverseMatch at /login/auth0
Exception Value: 'social' is not a registered namespace
내 응용 프로그램이 Dockerized, 그리고 내가 Auth0 및 social_django
통합을 시도하고있다. 내 스택에 nginx, gunicorn 및 postgres를 사용하고 있습니다. https://auth0.com/docs/quickstart/webapp/django
social_django
이
서브 응용 프로그램, authentication
내 주요 설정 파일에 설치 : 나는 주로 실행 얻을이 튜토리얼을 따라
# /src/my_app/settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'social_django',
'my_app.apps.authentication',
]
내 Auth0 통합 설정은 다음과 같이 :
# /src/my_app/settings.py
SOCIAL_AUTH_TRAILING_SLASH = False
SOCIAL_AUTH_AUTH0_DOMAIN = '[hidden]'
SOCIAL_AUTH_AUTH0_KEY = '[hidden]'
SOCIAL_AUTH_AUTH0_SECRET = '[hidden]'
SOCIAL_AUTH_AUTH0_SCOPE = [
'openid',
'profile'
]
AUTHENTICATION_BACKENDS = {
'my_app.apps.authentication.auth0backend.Auth0',
'django.contrib.auth.backends.ModelBackend'
}
LOGIN_URL = "/login/auth0"
LOGIN_REDIRECT_URL = "/dashboard"
LOGOUT_REDIRECT_URL = "/"
내 주요 응용 프로그램의 urls.py는 다음과 같습니다
# /src/my_app/urls.py
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('my_app.apps.authentication.urls', namespace='authentication')),
]
,536,913,632 10
그리고 인증 응용 프로그램에 대한 urls.py은 다음과 같습니다 : 나는 도커 이미지를 빌드 할 때
# /src/my_app/apps/authentication/urls.py
from django.conf.urls import include, url
from . import views
app_name = 'authentication'
urlpatterns = [
url('^$', views.index),
url(r'^dashboard', views.dashboard),
url(r'^', include('django.contrib.auth.urls', namespace='auth')),
url(r'^', include('social_django.urls', namespace='social')),
]
, 내가 위에서 설명한 오류, 실행 및 액세스 /login/auth0
.
내가 사용하고 있습니다 :
certifi (2017.7.27.1)
chardet (3.0.4)
defusedxml (0.5.0)
Django (1.11) # <---
ecdsa (0.13)
future (0.16.0)
gunicorn (19.6.0)
idna (2.6)
oauthlib (2.0.6)
pip (9.0.1)
psycopg2 (2.6.2)
pycrypto (2.6.1)
PyJWT (1.5.3)
python-jose (1.4.0)
python3-openid (3.1.0)
requests (2.18.4)
requests-oauthlib (0.8.0)
setuptools (36.6.0)
six (1.11.0)
social-auth-app-django (2.0.0) # <---
social-auth-core (1.5.0)
urllib3 (1.22)
wheel (0.30.0)
어떤 조언을? 고맙습니다!
URL 패턴이 괜찮아 보이는 일부 게시물은 django 1.10.5 (또는 그 이상)에 대한 업데이트가이 문제를 해결한다고 제안합니다. – PRMoureu
@PRMoureu 방금 django 1.11을 바꿔서 같은 문제가 발생했습니다. 또한 원래 게시물의 버전을 업데이트했습니다. (명확성을 위해 원래 1.10을 사용했습니다.) – zhirsch