def create_settings_file(init=True):
 settings_path = os.path.join(GAMEDIR, 'server', 'conf', 'settings.py')
 if (not init):
  if os.path.exists(settings_path):
   inp = raw_input('server/conf/settings.py already exists. Do you want to reset it? y/[N]> ')
   if (not (inp.lower() == 'y')):
    print('Aborted.')
    sys.exit()
   else:
    print('Reset the settings file.')
  default_settings_path = os.path.join(EVENNIA_TEMPLATE, 'server', 'conf', 'settings.py')
  shutil.copy(default_settings_path, settings_path)
 with open(settings_path, 'r') as f:
  settings_string = f.read()
 setting_dict = {'settings_default': os.path.join(EVENNIA_LIB, 'settings_default.py'), 'servername': ('"%s"' % GAMEDIR.rsplit(os.path.sep, 1)[1].capitalize()), 'secret_key': ("'%s'" % create_secret_key())}
 settings_string = settings_string.format(**setting_dict)
 with open(settings_path, 'w') as f:
  f.write(settings_string)

def create_settings_file ( init = True ) : settings_path = os . path . join ( GAMEDIR , 'server' , 'conf' , 'settings.py' ) if ( not init ) : if os . path . exists ( settings_path ) : inp = raw_input ( 'server/conf/settings.py already exists. Do you want to reset it? y/[N]> ' ) if ( not ( inp . lower ( ) == 'y' ) ) : print ( 'Aborted.' ) sys . exit ( ) else : print ( 'Reset the settings file.' ) default_settings_path = os . path . join ( EVENNIA_TEMPLATE , 'server' , 'conf' , 'settings.py' ) shutil . copy ( default_settings_path , settings_path ) with open ( settings_path , 'r' ) as f : settings_string = f . read ( ) setting_dict = { 'settings_default' : os . path . join ( EVENNIA_LIB , 'settings_default.py' ) , 'servername' : ( '"%s"' % GAMEDIR . rsplit ( os . path . sep , 1 ) [ 1 ] . capitalize ( ) ) , 'secret_key' : ( "'%s'" % create_secret_key ( ) ) } settings_string = settings_string . format ( ** setting_dict ) with open ( settings_path , 'w' ) as f : f . write ( settings_string )
uses the template settings file to build a working settings file .