7

django_allauth をインストールしましたが、アカウント/ログイン ビューにこのエラーが表示されます。

ImportError at /accounts/login/
No module named path.to
Request Method: GET
Request URL:    http://chew.local:5000/accounts/login/
Django Version: 1.5.1
Exception Type: ImportError
Exception Value:    
No module named path.to
Exception Location: /Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/site-packages/django/utils/importlib.py in import_module, line 35
Python Executable:  /Users/benbowler/Sites/Repositories/chew/venv/bin/python
Python Version: 2.7.2
Python Path:    
['/Users/benbowler/Sites/Repositories/chew',
 '/Users/benbowler/Sites/Repositories/chew/venv/bin',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python27.zip',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/plat-darwin',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/plat-mac',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/benbowler/Sites/Repositories/chew/venv/Extras/lib/python',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/lib-tk',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/lib-old',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/site-packages']
Server time:    Thu, 16 May 2013 15:01:20 +0100

providers_media_js は以下の赤色です。

Error during template rendering

In template /Users/benbowler/Sites/Repositories/chew/venv/lib/python2.7/site-packages/allauth/templates/socialaccount/snippets/login_extra.html, error at line 3
No module named path.to
1   {% load socialaccount %}
2   
3   **{% providers_media_js %}**
4

1 に答える 1

15

設定を見てください。コピーペースト違反をしたと思います:

このエラーの原因となる可能性のあるこのスニペットは、https: //django-allauth.readthedocs.org/en/latest/index.html?highlight=path.to#facebook からのものです。

SOCIALACCOUNT_PROVIDERS = \
{
    'facebook':
    {
        'SCOPE': ['email', 'publish_stream'],
        'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
        'METHOD': 'oauth2',
        'LOCALE_FUNC': 'path.to.callable',
        'VERIFIED_EMAIL': False
    }
}

LOCALE_FUNC存在しないパスではなく、適切な関数を定義する必要があるため、問題があったと思います。

これがその例です。Slideshare になる方法: https://speakerdeck.com/tedtieken/signing-up-and-signing-in-users-in-django-with-django-allauth?slide=55

SOCIALACCOUNT_PROVIDERS = \
{
    'facebook':
    {
        'SCOPE': ['email'],
        'AUTH_PARAMS': { 'auth_type': 'reauthenticate'},
        'METHOD': 'oauth2',
        'LOCALE_FUNC': lambda request: 'en_US'
    }
}

これがお役に立てば幸いです

于 2014-02-12T16:00:24.690 に答える