准备启动的配置文件,python运行不需要,uwsgi和gunicorn需要 @author baozi <202-02-22> @param: values ( dict ): 用户传入的参数 @return :
(self, values, force=False, pyenv: Optional[PythonEnvironment]=None)
| 843 | return public.returnMsg(True, "项目添加成功" + tip) |
| 844 | |
| 845 | def __prepare_start_conf(self, values, force=False, pyenv: Optional[PythonEnvironment]=None): |
| 846 | """准备启动的配置文件,python运行不需要,uwsgi和gunicorn需要 |
| 847 | @author baozi <202-02-22> |
| 848 | @param: |
| 849 | values ( dict ): 用户传入的参数 |
| 850 | @return : |
| 851 | """ |
| 852 | # 加入默认配置 |
| 853 | if pyenv is None: |
| 854 | pyenv = EnvironmentManager().get_env_py_path(values.get("python_bin", values.get("vpath"))) |
| 855 | public.print_log(pyenv.to_dict()) |
| 856 | if not pyenv: |
| 857 | return |
| 858 | values["user"] = values['user'] if 'user' in values else 'root' |
| 859 | values["processes"] = values['processes'] if 'processes' in values else 4 |
| 860 | values["threads"] = values['threads'] if 'threads' in values else 2 |
| 861 | if not os.path.isdir(values['logpath']): |
| 862 | os.makedirs(values['logpath'], mode=0o777) |
| 863 | |
| 864 | env_file = "{}/{}.env".format(self._env_path, values["pjname"]) |
| 865 | self._build_env_file(env_file, values) |
| 866 | |
| 867 | self.__prepare_uwsgi_start_conf(values, pyenv, force) |
| 868 | self.__prepare_gunicorn_start_conf(values, pyenv, force) |
| 869 | if "project_cmd" not in values: |
| 870 | values["project_cmd"] = '' |
| 871 | self.__prepare_cmd_start_conf(values, pyenv, force) |
| 872 | self.__prepare_python_start_conf(values, pyenv, force) |
| 873 | |
| 874 | @staticmethod |
| 875 | def _get_callable_app(project_config: dict): |
no test coverage detected