def served_by_django(url):
 r = requests.get(url, allow_redirects=False)
 status = (r.status_code == 200)
 django = (('x-served' not in r.headers) or (r.headers['x-served'] == 'nginx-via-django'))
 return all([status, django])

def served_by_django ( url ) : r = requests . get ( url , allow_redirects = False ) status = ( r . status_code == 200 ) django = ( ( 'x-served' not in r . headers ) or ( r . headers [ 'x-served' ] == 'nginx-via-django' ) ) return all ( [ status , django ] )
return true if url returns 200 and is served by django .