def prepare_site_db_and_overrides():
 _SITE_DB.clear()
 _SITE_DB[_MAIN_LANG] = _MAIN_SITEURL
 main_siteurl = ('/' if (_MAIN_SITEURL == '') else _MAIN_SITEURL)
 for (lang, overrides) in _SUBSITE_QUEUE.items():
  if ('SITEURL' not in overrides):
   overrides['SITEURL'] = posixpath.join(main_siteurl, lang)
  _SITE_DB[lang] = overrides['SITEURL']
  if ('OUTPUT_PATH' not in overrides):
   overrides['OUTPUT_PATH'] = os.path.join(_MAIN_SETTINGS['OUTPUT_PATH'], lang)
  if ('CACHE_PATH' not in overrides):
   overrides['CACHE_PATH'] = os.path.join(_MAIN_SETTINGS['CACHE_PATH'], lang)
  if ('STATIC_PATHS' not in overrides):
   overrides['STATIC_PATHS'] = []
  if (('THEME' not in overrides) and ('THEME_STATIC_DIR' not in overrides) and ('THEME_STATIC_PATHS' not in overrides)):
   relpath = relpath_to_site(lang, _MAIN_LANG)
   overrides['THEME_STATIC_DIR'] = posixpath.join(relpath, _MAIN_SETTINGS['THEME_STATIC_DIR'])
   overrides['THEME_STATIC_PATHS'] = []
  overrides['DEFAULT_LANG'] = lang

def prepare_site_db_and_overrides ( ) : _SITE_DB . clear ( ) _SITE_DB [ _MAIN_LANG ] = _MAIN_SITEURL main_siteurl = ( '/' if ( _MAIN_SITEURL == '' ) else _MAIN_SITEURL ) for ( lang , overrides ) in _SUBSITE_QUEUE . items ( ) : if ( 'SITEURL' not in overrides ) : overrides [ 'SITEURL' ] = posixpath . join ( main_siteurl , lang ) _SITE_DB [ lang ] = overrides [ 'SITEURL' ] if ( 'OUTPUT_PATH' not in overrides ) : overrides [ 'OUTPUT_PATH' ] = os . path . join ( _MAIN_SETTINGS [ 'OUTPUT_PATH' ] , lang ) if ( 'CACHE_PATH' not in overrides ) : overrides [ 'CACHE_PATH' ] = os . path . join ( _MAIN_SETTINGS [ 'CACHE_PATH' ] , lang ) if ( 'STATIC_PATHS' not in overrides ) : overrides [ 'STATIC_PATHS' ] = [ ] if ( ( 'THEME' not in overrides ) and ( 'THEME_STATIC_DIR' not in overrides ) and ( 'THEME_STATIC_PATHS' not in overrides ) ) : relpath = relpath_to_site ( lang , _MAIN_LANG ) overrides [ 'THEME_STATIC_DIR' ] = posixpath . join ( relpath , _MAIN_SETTINGS [ 'THEME_STATIC_DIR' ] ) overrides [ 'THEME_STATIC_PATHS' ] = [ ] overrides [ 'DEFAULT_LANG' ] = lang
prepare overrides and create _site_db _site_db .