1
需要创建中间件,该中间件将所有请求和执行时间存储在Django中。 我在DBTypeError:int()参数必须是字符串,类似字节的对象或数字,而不是'WSGIRequest'
models.py
class RequestInformation(models.Model):
list_of_requests = models.CharField(max_length=200)
创建了一列并且还可以通过Django文档看上去并创造middleware.py
from profileapp.models import RequestInformation
class CustomRequestMiddleware(object):
def process_request(self, request):
http_information = RequestInformation(request)
http_information.save()
的设置也添加了自定义的中间件。但不知道下一步该怎么做。
TypeError: int() argument must be a string, a bytes-like object or a
number, not 'WSGIRequest'
对不起FO愚蠢的问题,没有找到豪解决this.Thanks提前
应该有一个init方法和一个调用方法(自动执行每个请求)请再次阅读文档https://docs.djangoproject.com/en/1.11/topics/http/middleware/ –