2

ソーシャル認証にAll-Authを使用しようとしています。

必要な設定をアプリの settings.py に読み込んだ後、管理ページに入ってソーシャル トークンを入力する必要があります。

管理ページにログインするとすぐに。それは私にこのエラーを与えます:

Environment:

    Request Method: GET
    Request URL: http://127.0.0.1:8000/admin/
    
    Django Version: 1.5
    Python Version: 2.7.1
    Installed Applications:
    ('django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'main',
    'allauth',
    'allauth.account',
    'allauth.socialaccount')
    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')
    
    Traceback:
    File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response
    
    response = callback(request, *callbackargs, **callback_kwargs) File "/Library/Python/2.7/site-packages/django/contrib/admin/sites.py" in wrapper
    return self.admin_view(view, cacheable)(*args, **kwargs) File "/Library/Python/2.7/site-packages/django/utils/decorators.py" in _wrapped_view
    response = view_func(request, *args, **kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
    response = view_func(request, *args, **kwargs) File "/Library/Python/2.7/site-packages/django/contrib/admin/sites.py" in inner
    return view(request, *args, **kwargs) File "/Library/Python/2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
    response = view_func(request, *args, **kwargs) File "/Library/Python/2.7/site-packages/django/contrib/admin/sites.py" in index
    app['models'].sort(key=lambda x: x['name']) File "/Library/Python/2.7/site-packages/django/utils/functional.py" in lt
    other = other.cast() File "/Library/Python/2.7/site-packages/django/utils/functional.py" in __cast
    return self.text_cast() File "/Library/Python/2.7/site-packages/django/utils/functional.py" in __text_cast
    return func(*self.args, **self.kw) File "/Library/Python/2.7/site-packages/django/utils/text.py" in
    capfirst = lambda x: x and forcetext(x)[0].upper() + force_text(x)[1:] File "/Library/Python/2.7/site-packages/django/utils/functional.py" in __wrapper
    raise TypeError("Lazy object returned unexpected type.")
    Exception Type: TypeError at /admin/
    Exception Value: Lazy object returned unexpected type

この問題を解決するにはどうすればよいですか?なぜ例外が発生するのですか? 任意のヘルプやアイデアをいただければ幸いです。敬具

4

1 に答える 1

0

テキストを何に強制する関数があります... unicode?... ある場合は forcetext(x) 、2番目の場合は force_text(x) です。場合によっては、メソッドが存在しないため、おそらくエラー メッセージが返されます...

アラン

于 2013-04-19T06:33:13.023 に答える