问题
I cannot work out why I am getting:
Uncaught ReferenceError: allauth is not defined
...when clicking the Facebook link at: https://obscure-harbor-7751.herokuapp.com/accounts/signup/ hosted on Heroku. There is no related javascript rendered to the page, but I don't know where allauth would handle that from.
I'm quite sure that all relevant settings are correct (pasted below). I think it was working before and somehow stopped working of late (possibly due to an update pulled as a requirement on deployment). I am using django-cookiecutter.
Can anyone suggest what the problem might be? I've tried many things and looked for a live example online to see what sort of js i should expect but couldn't find any.
Please help!
Thanks,
Relevant settings:
TEMPLATE_CONTEXT_PROCESSORS = (
'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.contrib.messages.context_processors.messages',
'django.core.context_processors.request',
"allauth.account.context_processors.account",
"allauth.socialaccount.context_processors.socialaccount",
# Your stuff: custom template context processers go here
)
AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
"allauth.account.auth_backends.AuthenticationBackend",
)
INSTALLED_APPS += (
# Needs to come last for now because of a weird edge case between
# South and allauth
'allauth', # registration
'allauth.account', # registration
'allauth.socialaccount', # registration
'allauth.socialaccount.providers.facebook',
)
回答1:
Use the followings may be better:
{% providers_media_js %}
Ref: http://django-allauth.readthedocs.org/en/latest/templates.html
回答2:
I needed to add:
{% include "socialaccount/snippets/login_extra.html" %}
to templates/account/signup.html
for the javascript to appear on the page. I expected that to have been included.
来源:https://stackoverflow.com/questions/22994900/django-allauth-uncaught-referenceerror