Kein Modul mit dem Namen 'allauth.Konto.context_processors'
Will ich mit Django-Allauth, so installierte ich wie folgt und es funktioniert perfekt in mein laptop localhost, aber wenn ich ziehen Sie es in meinem server, ich
Begegnung mit der folgenden Fehlermeldung:
No module named 'allauth.account.context_processors'
Was soll ich tun?
# 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 <[email protected]>'
Ich nie benutzt Django-Alluth, also ich bin Neuling, bitte helft mir, so einfach, wie Sie können.
- Ist Ihr problem gelöst?
- Nein! es ist nicht gelöst!
- haben Sie den Befehl ausführen pip --freeze?Dass das, was ist die version von allauth ?
- In unserem Projekt haben auch wir standen vor diesem problem, aber wenn wir verschoben, um die frühere version der auth das problem war gelöst
- django-allauth==0.22.0
- Wie kann ich dies tun?
- Wie @Andre hat erwähnt, Sie haben zu tun, pip install django-allauth==0.21.0 für die Vorherige version
Du musst angemeldet sein, um einen Kommentar abzugeben.
Dies bedeutet, dass Sie verschiedene Versionen von Allauth in Ihrem dev-Maschine und auf deinem server. Sie sollten auf jeden Fall die gleiche version auf beiden Seiten.
In das warum der Frage zu treffen, die auf dem server, in version 0.22 der django-allauth, die Kontext-Prozessoren ersetzt worden durch die template-tags.
Brauchen Sie nur, um sicherzustellen, dass:
pip install django-allauth==0.22
)No module named context_processors
auch wenn allauth ist inINSTALLED_APPS
.Dieser Fehler bedeutet, dass das Modul nicht gefunden werden konnte.
Werden Sie wahrscheinlich nur brauchen, um installieren Sie die 3rd-party-Modul genannt
allauth
auf Ihrem server (oder fügen Sie es requirements.txt wenn Sie die automatische Bereitstellung wie auf Heroku).Können Sie laufen
pip freeze
vor Ort sehen, welche Module installiert sind.Installation einer bestimmten version von
django-allauth
verwenden:PYTHONPATH
ist gebrochen.Hatte es problem mit allauth 0.22.0, installieren allauth 0.20.0