>我正在尝试使用Python-Social-Auth库将我的Django网站与Github身份验证集成
到目前为止的配置:
settings.py
INSTALLED_APPS += (
...
"social_django",
"social_core",
)
AUTHENTICATION_BACKENDS = [
"account.auth_backends.UsernameAuthenticationBackend",
"social_core.backends.github.GithubOAuth2",
]
TEMPLATES = [
{
...
'context_processors': [
...
"social_django.context_processors.backends",
"social_django.context_processors.login_redirect",
],
},
},
]
登录.html
<a href="{% url "social:begin" "GithubOAuth2" %}">Github</a>
urls.py
url("^socialaccounts/", include('social_django.urls', namespace='socialaccounts')),
但是当我单击链接时,它显示一个 404 未找到页面。我在哪里放置密钥和其他 github 配置?
它们进入项目的settings.py
文件中。
INSTALLED_APPS += (
...
"social_django",
"social_core",
)
AUTHENTICATION_BACKENDS = [
"account.auth_backends.UsernameAuthenticationBackend",
"social_core.backends.github.GithubOAuth2",
]
TEMPLATES = [
{
...
'context_processors': [
...
"social_django.context_processors.backends",
"social_django.context_processors.login_redirect",
],
},
},
]
SOCIAL_AUTH_GITHUB_KEY = ''
SOCIAL_AUTH_GITHUB_SECRET = ''