From 1b3712c1893ac730fed8c0eca7dd344595593fe7 Mon Sep 17 00:00:00 2001 From: asciimoo Date: Sat, 19 Oct 2013 16:18:41 +0200 Subject: [PATCH] [enh] settings.py added --- .gitignore | 2 +- searx/settings.py | 12 ++++++++++++ searx/webapp.py | 9 +++++---- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 searx/settings.py diff --git a/.gitignore b/.gitignore index ea93f9501..0c4daccd3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ env -searx.conf +settings.py diff --git a/searx/settings.py b/searx/settings.py new file mode 100644 index 000000000..7c3c481e7 --- /dev/null +++ b/searx/settings.py @@ -0,0 +1,12 @@ + +port = 8888 + +secret_key = "ultrasecretkey" # change this! + +debug = False + +weights = {} # 'search_engine_name': float(weight) | default is 1.0 + +blacklist = [] # search engine blacklist + +categories = {} # custom search engine categories diff --git a/searx/webapp.py b/searx/webapp.py index 4a1de7905..4e81ed093 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -26,6 +26,7 @@ from flask import Flask, request, flash, render_template, url_for, Response, mak import ConfigParser from os import getenv from searx.engines import search, categories +from searx import settings import json cfg = ConfigParser.SafeConfigParser() @@ -36,7 +37,7 @@ cfg.read('searx.conf') app = Flask(__name__) -app.secret_key = cfg.get('app', 'secret_key') +app.secret_key = settings.secret_key opensearch_xml = ''' @@ -113,7 +114,7 @@ if __name__ == "__main__": from gevent import monkey monkey.patch_all() - app.run(debug = cfg.get('server', 'debug') - ,use_debugger = cfg.get('server', 'debug') - ,port = int(cfg.get('server', 'port')) + app.run(debug = settings.debug + ,use_debugger = settings.debug + ,port = settings.port )