Django view doesn't output correctly

Vicente G. Reyes - Oct 22 '19 - - Dev Community

I've tried the suggestions of the devs who answered the question but the domain still outputs offline even if they're online.

The domains are from an uploaded csv file which will be listed on the database then output an online or offline status depending on the live status of the domain.

0

I have a view which should output if the domain on the database is online or offline.

def pingDomain(request, page):
    page_object = get_object_or_404(Table, page=page)
    try:
        subprocess.check_call(['ping', '-c', '1',  page_object.page])
    except subprocess.CalledProcessError:
        host_online = True
    else:
        host_online = False
    context = {
        'online': host_online,
    }
    return render(request, 'home.html', context)

On the…

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player