@login_check
def connect(request):
 html_template = 'WebConsole/watcher_connect.html'
 GET = request.GET
 try:
  cp_type = int(GET['cp'])
  cp_port = int(GET['port'])
  cp_host = GET['host']
  cp_key = GET['key']
 except:
  context = {'err': '\xe8\xbf\x9b\xe7\xa8\x8b\xe6\x9c\xaa\xe8\xbf\x90\xe8\xa1\x8c'}
  return render(request, html_template, context)
 ws_url = ('ws://%s/wc/watcher/process_cmd?cp=%s&port=%s&host=%s&key=%s' % (request.META['HTTP_HOST'], cp_type, cp_port, cp_host, cp_key))
 context = {'http_host': request.META['HTTP_HOST'], 'ws_url': ws_url}
 return render(request, html_template, context)

@ login_check def connect ( request ) : html_template = 'WebConsole/watcher_connect.html' GET = request . GET try : cp_type = int ( GET [ 'cp' ] ) cp_port = int ( GET [ 'port' ] ) cp_host = GET [ 'host' ] cp_key = GET [ 'key' ] except : context = { 'err' : '\xe8\xbf\x9b\xe7\xa8\x8b\xe6\x9c\xaa\xe8\xbf\x90\xe8\xa1\x8c' } return render ( request , html_template , context ) ws_url = ( 'ws://%s/wc/watcher/process_cmd?cp=%s&port=%s&host=%s&key=%s' % ( request . META [ 'HTTP_HOST' ] , cp_type , cp_port , cp_host , cp_key ) ) context = { 'http_host' : request . META [ 'HTTP_HOST' ] , 'ws_url' : ws_url } return render ( request , html_template , context )
creates a connection to a postgresql database .