def get_url(uri=None, full_address=False):
 host_name = (frappe.local.conf.host_name or frappe.local.conf.hostname)
 if (uri and (uri.startswith(u'http://') or uri.startswith(u'https://'))):
  return uri
 if (not host_name):
  if (hasattr(frappe.local, u'request') and frappe.local.request and frappe.local.request.host):
   protocol = (u'https://' if (u'https' == frappe.get_request_header(u'X-Forwarded-Proto', u'')) else u'http://')
   host_name = (protocol + frappe.local.request.host)
  elif frappe.local.site:
   protocol = u'http://'
   if frappe.local.conf.ssl_certificate:
    protocol = u'https://'
   elif frappe.local.conf.wildcard:
    domain = frappe.local.conf.wildcard.get(u'domain')
    if (domain and frappe.local.site.endswith(domain) and frappe.local.conf.wildcard.get(u'ssl_certificate')):
     protocol = u'https://'
   host_name = (protocol + frappe.local.site)
  else:
   host_name = frappe.db.get_value(u'Website Settings', u'Website Settings', u'subdomain')
   if (not host_name):
    host_name = u'http://localhost'
 if (host_name and (not (host_name.startswith(u'http://') or host_name.startswith(u'https://')))):
  host_name = (u'http://' + host_name)
 if ((not uri) and full_address):
  uri = frappe.get_request_header(u'REQUEST_URI', u'')
 url = (urllib.basejoin(host_name, uri) if uri else host_name)
 return url

def get_url ( uri = None , full_address = False ) : host_name = ( frappe . local . conf . host_name or frappe . local . conf . hostname ) if ( uri and ( uri . startswith ( u'http://' ) or uri . startswith ( u'https://' ) ) ) : return uri if ( not host_name ) : if ( hasattr ( frappe . local , u'request' ) and frappe . local . request and frappe . local . request . host ) : protocol = ( u'https://' if ( u'https' == frappe . get_request_header ( u'X-Forwarded-Proto' , u'' ) ) else u'http://' ) host_name = ( protocol + frappe . local . request . host ) elif frappe . local . site : protocol = u'http://' if frappe . local . conf . ssl_certificate : protocol = u'https://' elif frappe . local . conf . wildcard : domain = frappe . local . conf . wildcard . get ( u'domain' ) if ( domain and frappe . local . site . endswith ( domain ) and frappe . local . conf . wildcard . get ( u'ssl_certificate' ) ) : protocol = u'https://' host_name = ( protocol + frappe . local . site ) else : host_name = frappe . db . get_value ( u'Website Settings' , u'Website Settings' , u'subdomain' ) if ( not host_name ) : host_name = u'http://localhost' if ( host_name and ( not ( host_name . startswith ( u'http://' ) or host_name . startswith ( u'https://' ) ) ) ) : host_name = ( u'http://' + host_name ) if ( ( not uri ) and full_address ) : uri = frappe . get_request_header ( u'REQUEST_URI' , u'' ) url = ( urllib . basejoin ( host_name , uri ) if uri else host_name ) return url
lookup and return page url .