def _first_djangoproject_dir(self, app_path): dirs = self._valid_dirs(app_path) log.debug("{0} Possible valid djangoapp folders: {1}".format(len(dirs), dirs)) for d in dirs: settings_path = os.path.join(app_path, d, 'settings.py') init_path = os.path.join(app_path, d, '__init__.py') if os.path.exists(settings_path) and os.path.exists(init_path): return d return None
def _load_django_extra_options(self, path): parsed = {} conf_file = os.path.join(path, 'django.json') log.debug("Reading {0}".format(conf_file)) if os.path.exists(conf_file): try: parsed = simplejson.load(open(conf_file)) except: log.exception("Error parsing {file}".format(file=conf_file)) return parsed
def _sigkill(self, pid, signum): try: os.kill(pid, signum) except: logger.debug("Non existant pid {0}".format(pid))
def _kill_pids(self, pids, signum, pidtype): for pidnumber in pids: logger.debug("Sending signal {sig} to {pidtype} pid={pid}".format(pid=pidnumber, sig=signum, pidtype=pidtype)) self._sigkill(pidnumber, signum)