18 lines
		
	
	
		
			489 B
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			489 B
		
	
	
	
		
			Python
		
	
	
	
# Create your tasks here
 | 
						|
from __future__ import absolute_import, unicode_literals
 | 
						|
from datetime import timedelta
 | 
						|
from apps.ops.models import DrfRequestLog
 | 
						|
# from celery import shared_task
 | 
						|
from django.utils import timezone
 | 
						|
 | 
						|
 | 
						|
# @shared_task()
 | 
						|
# def clear_drf_log():
 | 
						|
#     """清除7天前的日志记录
 | 
						|
 | 
						|
#     清除7天前的日志记录
 | 
						|
#     """
 | 
						|
#     now = timezone.now()
 | 
						|
#     days7_ago = now - timedelta(days=7)
 | 
						|
#     DrfRequestLog.objects.filter(create_time__lte=days7_ago).delete()
 |