def update_csp():
 for key in ('CSP_SCRIPT_SRC',):
  values = getattr(settings, key)
  new = set()
  for value in values:
   if (value.startswith('https://') and settings.DEBUG):
    res = value.replace('https://', 'http://')
    for v in (value, res):
     new.add(v)
    continue
   elif (value.startswith('http://') and (not settings.DEBUG)):
    continue
   else:
    new.add(value)
  setattr(settings, key, tuple(new))

def update_csp ( ) : for key in ( 'CSP_SCRIPT_SRC' , ) : values = getattr ( settings , key ) new = set ( ) for value in values : if ( value . startswith ( 'https://' ) and settings . DEBUG ) : res = value . replace ( 'https://' , 'http://' ) for v in ( value , res ) : new . add ( v ) continue elif ( value . startswith ( 'http://' ) and ( not settings . DEBUG ) ) : continue else : new . add ( value ) setattr ( settings , key , tuple ( new ) )
after settings .