Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django-allauth Uncaught ReferenceError

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',
)
like image 918
KindOfGuy Avatar asked Dec 09 '25 05:12

KindOfGuy


2 Answers

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.

like image 107
KindOfGuy Avatar answered Dec 11 '25 19:12

KindOfGuy


Use the followings may be better:

{% providers_media_js %}

Ref: http://django-allauth.readthedocs.org/en/latest/templates.html

like image 37
Chien-Wei Huang Avatar answered Dec 11 '25 18:12

Chien-Wei Huang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!