我需要为用户登录创建 REST API。如果成功,它应该返回一个 Secret 值,该值将存储在 REDIS 服务器中。我该怎么做呢?
我可以使用 tastypie-redis-resource 0.0.9 来做到这一点吗? https://pypi.python.org/pypi/tastypie-redis-resource
如果可以的话,你能告诉我我需要做什么吗?
最佳答案
以下是相关来源:https://github.com/tunix/tastypie-redis-resource/blob/master/tastypie_redis/resources.py
你可能想要这样的东西:
def obj_create(self, bundle, **kwargs):
kwargs['secret_field'] = get_new_secret_value()
return super(MyResource, self).obj_create(bundle, **kwargs)
关于django - 将 REDIS 与 Tastypie 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34895326/