diff options
author | Matej Cotman <cotman.matej@gmail.com> | 2014-01-12 12:40:27 +0100 |
---|---|---|
committer | Matej Cotman <cotman.matej@gmail.com> | 2014-01-14 23:31:15 +0100 |
commit | e740c8a8ea7dc4bbda7dab9a63ec476167c209ef (patch) | |
tree | 19fc35d68eb6570b4d4c8b04cf1f82a7d304dddc /searx/webapp.py | |
parent | 348187cff9bc3c55c1327f3d7177e6d1a61b8430 (diff) | |
download | searxng-e740c8a8ea7dc4bbda7dab9a63ec476167c209ef.tar.gz searxng-e740c8a8ea7dc4bbda7dab9a63ec476167c209ef.zip |
tests and robot tests framework, build overhaul
Diffstat (limited to 'searx/webapp.py')
-rw-r--r-- | searx/webapp.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 6c27369db..48448eb25 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -18,13 +18,20 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. ''' import os +import sys if __name__ == "__main__": - from sys import path - path.append(os.path.realpath(os.path.dirname(os.path.realpath(__file__))+'/../')) + sys.path.append(os.path.realpath(os.path.dirname(os.path.realpath(__file__))+'/../')) + +# first argument is for specifying settings module, used mostly by robot tests +from sys import argv +if len(argv) == 2: + from importlib import import_module + settings = import_module('searx.' + argv[1]) +else: + from searx import settings from flask import Flask, request, render_template, url_for, Response, make_response, redirect from searx.engines import search, categories, engines, get_engines_stats -from searx import settings import json import cStringIO from searx.utils import UnicodeWriter @@ -226,7 +233,7 @@ def favicon(): 'favicon.png', mimetype='image/vnd.microsoft.icon') -if __name__ == "__main__": +def run(): from gevent import monkey monkey.patch_all() @@ -234,3 +241,7 @@ if __name__ == "__main__": ,use_debugger = settings.debug ,port = settings.port ) + + +if __name__ == "__main__": + run() |