您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

39 行
872 B

  1. import os
  2. import platform
  3. import click
  4. import bench
  5. from bench.app import use_rq
  6. from bench.bench import Bench
  7. from bench.utils import which
  8. def setup_procfile(bench_path, yes=False, skip_redis=False):
  9. config = Bench(bench_path).conf
  10. procfile_path = os.path.join(bench_path, "Procfile")
  11. is_mac = platform.system() == "Darwin"
  12. if not yes and os.path.exists(procfile_path):
  13. click.confirm(
  14. "A Procfile already exists and this will overwrite it. Do you want to continue?",
  15. abort=True,
  16. )
  17. procfile = (
  18. bench.config.env()
  19. .get_template("Procfile")
  20. .render(
  21. node=which("node") or which("nodejs"),
  22. use_rq=use_rq(bench_path),
  23. webserver_port=config.get("webserver_port"),
  24. CI=os.environ.get("CI"),
  25. skip_redis=skip_redis,
  26. workers=config.get("workers", {}),
  27. is_mac=is_mac,
  28. )
  29. )
  30. with open(procfile_path, "w") as f:
  31. f.write(procfile)