__init__.py 509B

1234567891011121314151617181920
  1. from os import environ
  2. from os.path import realpath, dirname, join, abspath
  3. try:
  4. from yaml import load
  5. except:
  6. from sys import exit, stderr
  7. stderr.write('[E] install pyyaml\n')
  8. exit(2)
  9. searx_dir = abspath(dirname(__file__))
  10. engine_dir = dirname(realpath(__file__))
  11. if 'SEARX_SETTINGS_PATH' in environ:
  12. settings_path = environ['SEARX_SETTINGS_PATH']
  13. else:
  14. settings_path = join(searx_dir, 'settings.yml')
  15. with open(settings_path) as settings_yaml:
  16. settings = load(settings_yaml)