def prepare(self): from utils import log_setting log_setting(CONFIG.LOGGING_INI, CONFIG.DATA_ROOT) self.logger = logging.getLogger("index_daemon") self.logger.path = CONFIG.DATA_ROOT import lucene os.environ['JAVA_HOME'] = '/usr/local/jdk1.6.0_17' lucene.initVM(lucene.CLASSPATH) self.svnclient = CliClient(work_path=CONFIG.TESTCASE_ROOT) self.new_updated_version = None self.updated_items = None self.last_index_trigger = CONFIG.LAST_UPDATED self.last_index_version = None self.logger.info("test case path:%s" % CONFIG.TESTCASE_ROOT) #self.logger.removeHandler(hdlr) self.run = self.update_subversion os.chdir(CONFIG.DATA_ROOT)
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": import sys, os cwd = os.path.abspath(os.path.dirname(__file__)) os.chdir(cwd) from utils import log_setting log_setting(settings.CONFIG.LOGGING_INI, settings.CONFIG.DATA_ROOT) execute_manager(settings)