Skip to main content

Pywhio

官方 @ PywhiO. Python大数据, AI技术, 微服务, DRF+REACT前后端分离实践.

1 min read · January 15th 2020 (originally published at pywhio)

Pageview模块上线

阅读:-


Pageview模块上线

Pageview模块上线了,利用DRF后台实现了阅读量的收集和反馈,通过React前端封装组件进行呈现。

数据模型简单定义如下:

#models.py
class Viewrecord(models.Model):
    created = models.DateTimeField(auto_now_add=True)
    user = models.CharField(max_length=100, blank=True, default='')
    ip = models.CharField(max_length=100, blank=True, default='')
    user_agent= models.CharField(max_length=200, blank=True, default='')
    slug = models.CharField(max_length=200, blank=True, default='')

class Pageview(models.Model):
    slug = models.CharField(max_length=200, primary_key=True)
    count = models.BigIntegerField(default=0)
分享到微博

Previous

如何利用celery处理Email
Starter
MicroServ
Tutorials
Report
Blog