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.
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...
` ^
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.