10

I am following this tutorial to integrate social media login to my django project -

http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial/

However after completing all the steps, when I try to login using facebook, I get this error

relation "account_emailaddress" does not exist

I don't understand what has gone wrong as all the DB modifications ran properly without errors.

Thanks in advance for your valuable answers.

Stacktrace

Environment:


Request Method: POST
Request URL: example.com/accounts/facebook/login/token/

Django Version: 1.6.6
Python Version: 2.7.4
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.contrib.admin',
 'django.contrib.comments',
 'south',
 'registration',
 'endless_pagination',
 'links',
 'south',
 'debug_toolbar',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'allauth.socialaccount.providers.facebook')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/providers/facebook/views.py" in login_by_token
  76.                     ret = complete_social_login(request, login)
File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/helpers.py" in complete_social_login
  119.         return _complete_social_login(request, sociallogin)
File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/helpers.py" in _complete_social_login
  130.         ret = _process_signup(request, sociallogin)
File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/helpers.py" in _process_signup
  26.                                                        sociallogin)
File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/adapter.py" in is_auto_signup_allowed
  121.                     if email_address_exists(email):
File "/usr/local/lib/python2.7/dist-packages/allauth/utils.py" in email_address_exists
  85.     ret = emailaddresses.filter(email__iexact=email).exists()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in exists
  515.             return self.query.has_results(using=self.db)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py" in has_results
  409.         return bool(compiler.execute_sql(SINGLE))
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in execute_sql
  786.         cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py" in execute
  69.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py" in __exit__
  99.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py" in execute
  53.                 return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /accounts/facebook/login/token/
Exception Value: relation "account_emailaddress" does not exist
LINE 1: SELECT (1) AS "a" FROM "account_emailaddress" WHERE UPPER("a...

` ^

2
  • Can you post the full stacktrace? Have you set up the Facebook app in the Django admin? You need to make a DB entry with your Facebook app details Sep 13, 2014 at 9:52
  • @TimmyO'Mahony - I have included the traceback now. Also I had added the Facebook app details in the table 'socialaccount_socialapp_sites' Sep 13, 2014 at 10:15

2 Answers 2

13

I figured out what the problem was. the allauth uses account app which doesn't support migrations as yet. Initially I had run

python manage.py migrate allauth.socialaccount
python manage.py migrate allauth.socialaccount.providers.facebook

Along with this we need to run the syncdb to complete the puzzle.

1
  • 1
    great..glad it was useful for you! Oct 22, 2014 at 7:33
9

I think you added library providers after performing the first migration, this leaves pending migrations

run

python manage.py makemigrations allauth

and

python manage.py migrate allauth

1
  • I believe that adding providers from the library after performing the first migration, this leaves pending migrations Mar 17, 2020 at 20:14

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.