config_manager.py 561 B

1234567891011121314151617181920212223242526272829
  1. import configparser
  2. from pathlib import Path
  3. path_to_file = "configuration.ini"
  4. def create_conf_file() :
  5. parser = configparser.ConfigParser()
  6. parser.add_section('core')
  7. parser.set('core', 'default_admin_password', 'aseqzdwxc')
  8. parser.add_section('log')
  9. parser.set('log', 'console_log_level', 'DEBUG')
  10. parser.set('log', 'file_log_level', 'DEBUG')
  11. fp=open(path_to_file,'w')
  12. parser.write(fp)
  13. fp.close()
  14. path = Path(path_to_file)
  15. if path.is_file() :
  16. None
  17. else :
  18. create_conf_file()