[enh] settings.py added

This commit is contained in:
asciimoo 2013-10-19 16:18:41 +02:00
parent bbdd255407
commit 1b3712c189
3 changed files with 18 additions and 5 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
env env
searx.conf settings.py

12
searx/settings.py Normal file
View file

@ -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

View file

@ -26,6 +26,7 @@ from flask import Flask, request, flash, render_template, url_for, Response, mak
import ConfigParser import ConfigParser
from os import getenv from os import getenv
from searx.engines import search, categories from searx.engines import search, categories
from searx import settings
import json import json
cfg = ConfigParser.SafeConfigParser() cfg = ConfigParser.SafeConfigParser()
@ -36,7 +37,7 @@ cfg.read('searx.conf')
app = Flask(__name__) app = Flask(__name__)
app.secret_key = cfg.get('app', 'secret_key') app.secret_key = settings.secret_key
opensearch_xml = '''<?xml version="1.0" encoding="utf-8"?> opensearch_xml = '''<?xml version="1.0" encoding="utf-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
@ -113,7 +114,7 @@ if __name__ == "__main__":
from gevent import monkey from gevent import monkey
monkey.patch_all() monkey.patch_all()
app.run(debug = cfg.get('server', 'debug') app.run(debug = settings.debug
,use_debugger = cfg.get('server', 'debug') ,use_debugger = settings.debug
,port = int(cfg.get('server', 'port')) ,port = settings.port
) )