create_setting.py 693 B

123456789101112131415161718192021222324252627
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on 2021/4/23 13:20
  4. ---------
  5. @summary: 生成配置文件
  6. ---------
  7. @author: mkdir700
  8. @email: mkdir700@gmail.com
  9. """
  10. import os
  11. import shutil
  12. class CreateSetting:
  13. def create(self):
  14. if os.path.exists("setting.py"):
  15. confirm = input("配置文件已存在 是否覆盖 (y/n). ")
  16. if confirm != "y":
  17. print("取消覆盖 退出")
  18. return
  19. template_file_path = os.path.abspath(
  20. os.path.join(__file__, "../../../templates/project_template/setting.py")
  21. )
  22. shutil.copy(template_file_path, "./", follow_symlinks=False)
  23. print("配置文件生成成功")