python Django 大量数据处理问题 求高手指点谢谢,送出满分财富进行感谢
我的DJangoweb页面上要有一个下载的按钮,那个下载的按钮是根据查询结果进行查询的,我查询出几百几千条下载没事,但是我下载几万条就卡死了,求高手帮忙解决,送出满分财富...
我的DJango web页面上要有一个下载的按钮 ,那个下载的按钮是根据查询结果进行查询的,我查询出几百几千条下载没事,但是我下载几万条就卡死了,求高手帮忙解决,送出满分财富进行感谢
代码处理如下:
页面代码:【<input type="button" class="coolbg" name="export" value="生成所查特征" onClick="javascript:window.open('/Rule_list/?export=1{{action}}')"/>】
views代码:
adminSamplelist方法我省的了很多代码,把关键性的现实出来了
【
def adminSamplelist(request):
RulelistAll = RuleList.objects.order_by('rule_id').filter(querylist).values('id','rule_id','vulname','lastupdate','status','content','description','cve_id','bid','redactor','memo','other')
if request.GET.get('export') == '1':
return Export_syslog(querylist)
def Export_syslog(Qlist):
sys_str = ''
times = '#Version: '+time.strftime("%Y%m%d.%H%M%S",time.gmtime())+'\n'
rule_list = RuleList.objects.order_by('rule_id').filter(Qlist).values('content')
for rules in rule_list:
if rules['content']:
sys_str += (rules['content']+'\n')
sysMD5 = md5.new(times+sys_str).hexdigest()
finalsyslog = times+sys_str+'#'+sysMD5
response = HttpResponse(mimetype='text/html')
response['Content-Disposition'] = 'attachment;filename=syslog-plaintext.dat'
response.write(finalsyslog)
return response
】
url代码 展开
代码处理如下:
页面代码:【<input type="button" class="coolbg" name="export" value="生成所查特征" onClick="javascript:window.open('/Rule_list/?export=1{{action}}')"/>】
views代码:
adminSamplelist方法我省的了很多代码,把关键性的现实出来了
【
def adminSamplelist(request):
RulelistAll = RuleList.objects.order_by('rule_id').filter(querylist).values('id','rule_id','vulname','lastupdate','status','content','description','cve_id','bid','redactor','memo','other')
if request.GET.get('export') == '1':
return Export_syslog(querylist)
def Export_syslog(Qlist):
sys_str = ''
times = '#Version: '+time.strftime("%Y%m%d.%H%M%S",time.gmtime())+'\n'
rule_list = RuleList.objects.order_by('rule_id').filter(Qlist).values('content')
for rules in rule_list:
if rules['content']:
sys_str += (rules['content']+'\n')
sysMD5 = md5.new(times+sys_str).hexdigest()
finalsyslog = times+sys_str+'#'+sysMD5
response = HttpResponse(mimetype='text/html')
response['Content-Disposition'] = 'attachment;filename=syslog-plaintext.dat'
response.write(finalsyslog)
return response
】
url代码 展开
若以下回答无法解决问题,邀请你更新回答
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询