def run(): options = get_options() # determine app action if options.run_tests: import tests tests.run_all() elif options.show_version: show_version() elif options.show_stats: show_stats() elif options.run_server: run_server() elif options.reindex: reindex() else: print 'Use -h to see options.'
def run(): options = get_options() # determine app action if options.run_tests: import tests test_result = tests.run_all() if not test_result: sys.exit('Tests failed.') elif options.show_version: show_version() elif options.show_stats: show_stats() elif options.run_server: run_server() elif options.reindex: reindex() else: print 'Use -h to see options.'
def run(): options = get_options() # determine app action if options.run_tests: import tests test_result = tests.run_all() if not test_result: sys.exit("Tests failed.") elif options.show_version: show_version() elif options.show_stats: show_stats() elif options.run_server: run_server() elif options.reindex: reindex() else: print "Use -h to see options."
def run(): if settings.DEBUG: logging.basicConfig(format='%(asctime)s %(levelname)s - %(message)s', level=logging.DEBUG) options = get_options() # determine app action if options.run_tests: import tests test_result = tests.run_all() if not test_result: sys.exit('Tests failed.') elif options.show_version: show_version() elif options.show_stats: show_stats() elif options.run_server: run_server() elif options.reindex: reindex() else: print('Use -h to see options.')
# Should not be changed, this is the absolute path to the directory # containing main.py, settings.py, core/, etc. # type: string # default: os.path.dirname(__file__) ROOT_DIR = os.path.dirname(__file__) config = {} from app_args import get_options try: import yaml # Try to load local settings (given path first, then relative/local), which override the default settings. # In local_settings.yml, set the values for any settings you want to override. default_yaml_path = os.path.join(ROOT_DIR, 'local_settings.yml') yaml_path = get_options().config if not yaml_path or not os.path.isfile(yaml_path): if yaml_path: print 'No config at %s' % yaml_path else: print 'No yaml config' print 'Setup the local_settings.yml config.' if yaml_path and os.path.isfile(yaml_path): # try the specified config path config = yaml.load(open(yaml_path, 'r')) elif os.path.isfile(default_yaml_path): yaml_path = default_yaml_path # try default path, proj/root directory config = yaml.load(open(yaml_path, 'r')) if config:
# Should not be changed, this is the absolute path to the directory # containing main.py, settings.py, core/, etc. # type: string # default: os.path.dirname(__file__) ROOT_DIR = os.path.dirname(__file__) config = {} from app_args import get_options try: import yaml # Try to load local settings (given path first, then relative/local), which override the default settings. # In local_settings.yml, set the values for any settings you want to override. default_yaml_path = os.path.join(ROOT_DIR, 'local_settings.yml') yaml_path = get_options().config or default_yaml_path if not yaml_path or not os.path.isfile(yaml_path): if yaml_path: print 'No config at %s' % yaml_path else: print 'No yaml config' print 'Setup the local_settings.yml config.' # try to load the config if yaml_path and os.path.isfile(yaml_path): config = yaml.load(open(yaml_path, 'r')) if config: print 'Loaded Sherlock config settings from %s' % yaml_path except ImportError:
# Should not be changed, this is the absolute path to the directory # containing main.py, settings.py, core/, etc. # type: string # default: os.path.dirname(__file__) ROOT_DIR = os.path.dirname(__file__) config = {} from app_args import get_options try: import yaml # Try to load local settings (given path first, then relative/local), which override the default settings. # In local_settings.yml, set the values for any settings you want to override. default_yaml_path = os.path.join(ROOT_DIR, 'local_settings.yml') yaml_path = get_options().config or default_yaml_path if not yaml_path or not os.path.isfile(yaml_path): if yaml_path: print('No config at %s' % yaml_path) else: print('No yaml config') print('Setup the local_settings.yml config.') # try to load the config if yaml_path and os.path.isfile(yaml_path): config = yaml.load(open(yaml_path, 'r')) if config: print('Loaded Sherlock config settings from %s' % yaml_path) except ImportError:
import os # Should not be changed, this is the absolute path to the directory # containing main.py, settings.py, core/, etc. # type: string # default: os.path.dirname(__file__) ROOT_DIR = os.path.dirname(__file__) config = {} from app_args import get_options try: import yaml # Try to load local settings (given path first, then relative/local), which override the default settings. # In local_settings.yml, set the values for any settings you want to override. default_yaml_path = os.path.join(ROOT_DIR, 'local_settings.yml') yaml_path = get_options().config if not os.path.isfile(yaml_path): print 'No config at %s' % yaml_path if yaml_path and os.path.isfile(yaml_path): # try the specified config path config = yaml.load(open(yaml_path, 'r')) elif os.path.isfile(default_yaml_path): yaml_path = default_yaml_path # try default path, proj/root directory config = yaml.load(open(yaml_path, 'r')) if config: print 'Loaded Sherlock config settings from %s' % yaml_path except ImportError: print 'No yaml lib: pip install pyyaml' # `%(sherlock_dir)s` resolves to the directory where sherlock is installed.