【发布时间】:2026-02-18 19:40:01
【问题描述】:
我想使用 Django-Allauth,所以我安装如下,它在我的笔记本电脑 localhost 中完美运行;但是当我把它拉进我的服务器时,我 遇到以下错误:
No module named 'allauth.account.context_processors'
我该怎么办?
# Django AllAuth
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
# Already defined Django-related contexts here
# `allauth` needs this from django
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
# `allauth` specific context processors
'allauth.account.context_processors.account',
'allauth.socialaccount.context_processors.socialaccount',
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.core.context_processors.request",
"moolak.context_processors.image",
],
},
},
]
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
)
SOCIALACCOUNT_QUERY_EMAIL = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
SOCIALACCOUNT_PROVIDERS = \
{'google':
{'SCOPE': ['profile', 'email'],
'AUTH_PARAMS': {'access_type': 'online'}}}
SOCIALACCOUNT_PROVIDERS = \
{'facebook': {'SCOPE': ['email', 'public_profile', 'user_friends'], 'AUTH_PARAMS': {'auth_type': 'reauthenticate'}, 'METHOD': 'js_sdk', 'VERSION': 'v2.3'}}
# newsletter
NEWSLETTER_DEFAULT_HEADER_SENDER = 'NewsLetter <info@m.com>'
我从未使用过 Django-Alluth,所以我是新手,请尽可能简单地帮助我。
【问题讨论】:
-
你的问题解决了吗?
-
不!没解决!
-
你有运行命令 pip --freeze 吗?在那里面是什么版本的 allauth ?
-
在我们的项目中,我们也遇到了这个问题,但是当我们转移到所有身份验证的以前版本时,问题就解决了
-
正如@Andre 所说,您必须为以前的版本执行 pip install django-allauth==0.21.0
标签: python django packages django-allauth django-settings