Django saving the whole request for statistics, whats available?

前端 未结 3 2093
难免孤独
难免孤独 2020-12-14 03:45

I want to save everything that can be used for statistics, such as referrer, os, browser etc. What is available and what\'s the best way to store it?

This is only im

3条回答
  •  执念已碎
    2020-12-14 04:07

    Extension to Josh answer, you could use JSONField for post data if you are using postgres as your backend. It will help in dealing with json directly rather than loading it manually.

    read more: https://docs.djangoproject.com/en/2.0/ref/contrib/postgres/fields/#jsonfield

    you could do something like this

    from django.contrib.postgres.fields import JSONField
    
    class WebRequest(models.Model):
        post = JSONField(default=dict)
    

提交回复
热议问题