我正在按照本教程将社交媒体登录集成到我的django项目中 -
http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial/
然而,在完成所有步骤后,当我尝试使用facebook登录时,我收到此错误
relation "account_emailaddress" does not exist
我不明白出现了什么问题,因为所有数据库修改都正常运行而没有错误。
提前感谢您的宝贵答案。
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...
`^
答案 0 :(得分:9)
我弄清楚问题是什么。 allauth
使用的account
应用尚未支持迁移。最初我跑了
python manage.py migrate allauth.socialaccount
python manage.py migrate allauth.socialaccount.providers.facebook
与此同时,我们需要运行syncdb
来完成拼图。
答案 1 :(得分:2)
我认为您是在执行首次迁移后添加的库提供程序,因此有待进行的迁移
运行
python manage.py makemigrations allauth
和
python manage.py migrate allauth