django零散知识点

  • 后端将对象以对象形式传到前端:
from django.core.serializers import serialize

def xxx(reqeust):
    
    project_list = models.ProjectManage.objects.filter(pk=id).first().projectmodel_set.all()
    return JsonResponse({"modelList": serialize('json', project_list),})
  •  selenium刷新页面
刷新页面:

driver.refresh()
  •  python获取cpu核数
    from multiprocessing import cpu_count
    
    print(cpu_count())    >>>   4

     

 
posted @ 2019-11-17 17:27  Ablert丶  阅读(72)  评论(0编辑  收藏  举报