mercredi 3 janvier 2018

Django website loads slow after using requests to check broken links

My website gives deatails about different servers. I have used requests to check which server ILO IP is not working through http and which is not.

AFter using requests.. the page loads super slow!

My server checks ILO Ips of many servers and if the server is broken it shows the IP as a text and if not it shows a link(THE IP) to the ILO.

Do you know how to make the server load much faster? Thanks..

models.py - from django.db import models

import requests

class serverlist(models.Model):
    ServerName = models.CharField(max_length = 30,blank=True)
    Owner = models.CharField(max_length = 50,blank=True)
    Project = models.CharField(max_length = 30,blank=True)
    Description = models.CharField(max_length = 255,blank=True)
    IP = models.CharField(max_length = 30,blank=True)
    ILO = models.CharField(max_length = 30,blank=True)
    Rack = models.CharField(max_length = 30,blank=True)
    Status = models.CharField(max_length = 30,blank=True)

    def checkUrlAvailable(self):
        ip_check = 'https://' + self.ILO
        resp = requests.head(ip_check,allow_redirects=False)
        if resp.status_code == 303:
            return True
        else:
            return False

index.html -

Liquid error: Unknown operator is




Aucun commentaire:

Enregistrer un commentaire