Browse Source

[enh] settings.py added

asciimoo 11 years ago
parent
commit
1b3712c189
3 changed files with 18 additions and 5 deletions
  1. 1
    1
      .gitignore
  2. 12
    0
      searx/settings.py
  3. 5
    4
      searx/webapp.py

+ 1
- 1
.gitignore View File

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

+ 12
- 0
searx/settings.py View File

1
+
2
+port = 8888
3
+
4
+secret_key = "ultrasecretkey" # change this!
5
+
6
+debug = False
7
+
8
+weights = {} # 'search_engine_name': float(weight) | default is 1.0
9
+
10
+blacklist = [] # search engine blacklist
11
+
12
+categories = {} # custom search engine categories

+ 5
- 4
searx/webapp.py View File

26
 import ConfigParser
26
 import ConfigParser
27
 from os import getenv
27
 from os import getenv
28
 from searx.engines import search, categories
28
 from searx.engines import search, categories
29
+from searx import settings
29
 import json
30
 import json
30
 
31
 
31
 cfg = ConfigParser.SafeConfigParser()
32
 cfg = ConfigParser.SafeConfigParser()
36
 
37
 
37
 
38
 
38
 app = Flask(__name__)
39
 app = Flask(__name__)
39
-app.secret_key = cfg.get('app', 'secret_key')
40
+app.secret_key = settings.secret_key
40
 
41
 
41
 opensearch_xml = '''<?xml version="1.0" encoding="utf-8"?>
42
 opensearch_xml = '''<?xml version="1.0" encoding="utf-8"?>
42
 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
43
 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
113
     from gevent import monkey
114
     from gevent import monkey
114
     monkey.patch_all()
115
     monkey.patch_all()
115
 
116
 
116
-    app.run(debug        = cfg.get('server', 'debug')
117
-           ,use_debugger = cfg.get('server', 'debug')
118
-           ,port         = int(cfg.get('server', 'port'))
117
+    app.run(debug        = settings.debug
118
+           ,use_debugger = settings.debug
119
+           ,port         = settings.port
119
            )
120
            )