def _root_domain():
    """
    Deduce the root domain name - usually a 'naked' domain.
    
    This only needs to be done prior to the first deployment
    """

    if not hasattr(env,'root_domain'):
        cwd = os.getcwd().split(os.sep)
        domain = ''
        #if the first env.host has a domain name then we'll use that
        #since there are no top level domains that have numbers in them we can test env.host

        username, host, port = normalize(env.hosts[0])
        if host[-1] in string.ascii_letters:
            domain_parts = env.host.split('.')
            length = len(domain_parts)
            if length==2:
                #assumes .com .net etc so we want the full hostname for the domain
                domain = host
            elif length==3 and len(domain_parts[-1])==2:
                #assume country tld so we want the full hostname for domain
                domain = host
            elif length >=3:
                #assume the first part is the hostname of the machine
                domain = '.'.join(domain[1:])
        #we'll just pick the first directory in the path which has a period.
        else:
            for d in cwd:
                if '.' in d: 
                    domain = d
        if not domain and env.INTERACTIVE:
            domain = prompt('Enter the root domain for this project ',default='example.com')
        else:
            domain = 'example.com'
        env.root_domain = domain
    return env.root_domain
def _root_domain ( ) : if not hasattr ( env , 'root_domain' ) : cwd = os . getcwd ( ) . split ( os . sep ) domain = '' username , host , port = normalize ( env . hosts [ 0 ] ) if host [ - 1 ] in string . ascii_letters : domain_parts = env . host . split ( '.' ) length = len ( domain_parts ) if length == 2 : domain = host elif length == 3 and len ( domain_parts [ - 1 ] ) == 2 : domain = host elif length >= 3 : domain = '.' . join ( domain [ 1 : ] ) else : for d in cwd : if '.' in d : domain = d if not domain and env . INTERACTIVE : domain = prompt ( 'Enter the root domain for this project ' , default = 'example.com' ) else : domain = 'example.com' env . root_domain = domain return env . root_domain
Deduce the root domain name - usually a 'naked' domain.
    
    This only needs to be done prior to the first deployment