【问题标题】:'AppSettings' object has no attribute 'STORE_TOKENS'\'AppSettings\' 对象没有属性 \'STORE_TOKENS\'
【发布时间】:2022-10-22 18:44:46
【问题描述】:

我有对象:应用设置app_settings.py

类 AppSettings(对象): 定义在里面(自我,前缀): self.prefix = 前缀

def _setting(self, name, dflt):
    from django.conf import settings

    getter = getattr(
        settings,
        "ALLAUTH_SETTING_GETTER",
        lambda name, dflt: getattr(settings, name, dflt),
    )
    return getter(self.prefix + name, dflt)

    @property
    def STORE_TOKENS(self):
        return self._setting("STORE_TOKENS", False)`

当它在我的请求中models.py

经过:

if app_settings.STORE_TOKENS and self.token and self.token.app.pk:

得到属性错误说!

'应用设置'对象没有属性“STORE_TOKENS”。

【问题讨论】:

    标签: python django twitter-oauth django-allauth


    【解决方案1】:

    在您的 settings.py 中,您需要添加以下行:

    STORE_TOKENS= True
    

    【讨论】:

    • 仍然得到同样的错误! “AppSettings”对象没有属性“STORE_TOKENS”
    【解决方案2】:

    实际上问题是....我在登录 django 管理期间尝试进行身份验证。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-12-01
      • 2021-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-17
      相关资源
      最近更新 更多