diff --git a/conda_env.yml b/conda_env.yml deleted file mode 100644 index 11f9052..0000000 --- a/conda_env.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: listservs -channels: - - defaults -dependencies: - - openssl=1.0.2 - - pip=9.0.1=py34_1 - - python=3.4.5=0 - - readline=6.2=2 - - setuptools=27.2.0=py34_0 - - sqlite=3.13.0=0 - - tk=8.5.18=0 - - wheel=0.29.0=py34_0 - - xz=5.2.2 - - zlib=1.2.8 - - pip: - - beautifulsoup4==4.7.1 - - click==7.0 - - dateparser==0.7.1 - - flask==1.0.4 - - gunicorn==19.9.0 - - html5lib==1.0.1 - - itsdangerous==1.1.0 - - jinja2==2.10.1 - - markupsafe==1.1.1 - - mysql-connector-python==8.0.16 - - protobuf==3.8.0 - - python-dateutil==2.8.0 - - pytz==2019.1 - - regex==2019.6.8 - - six==1.12.0 - - soupsieve==1.9.2 - - tzlocal==1.5.1 - - webencodings==0.5.1 - - werkzeug==0.15.4 - diff --git a/conda_env_arm7.yml b/conda_env_arm7.yml deleted file mode 100644 index 4ad161f..0000000 --- a/conda_env_arm7.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: listservs -dependencies: -- openssl=1.0.1k=1 -- pip=7.1.2=py34_0 -- python=3.4.3=1 -- setuptools=18.1=py34_0 -- sqlite=3.8.4.1=1 -- wheel=0.24.0=py34_0 -- xz=5.0.5=0 -- zlib=1.2.8=0 -- pip: - - click==7.0 - - dateparser==0.7.1 - - flask==1.1.1 - - gunicorn==19.9.0 - - itsdangerous==1.1.0 - - jinja2==2.10.1 - - markupsafe==1.1.1 - - mysql-connector-python==8.0.16 - - protobuf==3.8.0 - - python-dateutil==2.8.0 - - pytz==2019.1 - - regex==2019.6.8 - - six==1.12.0 - - tzlocal==1.5.1 - - werkzeug==0.15.4 - diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..852222a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,21 @@ +click==8.1.3 +dateparser==1.1.1 +DateTime==4.4 +Flask==2.1.2 +gunicorn==20.1.0 +importlib-metadata==4.12.0 +itsdangerous==2.1.2 +Jinja2==3.1.2 +MarkupSafe==2.1.1 +mysql-connector-python==8.0.29 +protobuf==4.21.2 +python-dateutil==2.8.2 +pytz==2022.1 +pytz-deprecation-shim==0.1.0.post0 +regex==2022.3.2 +six==1.16.0 +tzdata==2022.1 +tzlocal==4.2 +Werkzeug==2.1.2 +zipp==3.8.0 +zope.interface==5.4.0 diff --git a/setenv b/setenv index 4cb970f..619fe07 100644 --- a/setenv +++ b/setenv @@ -1 +1 @@ -source activate listservs +source venv/bin/activate diff --git a/www-serve b/www-serve index 728ad32..e2ca77a 100755 --- a/www-serve +++ b/www-serve @@ -1,3 +1,3 @@ #!/bin/bash -source activate listserv +source venv/bin/activate gunicorn -w 1 --bind 0.0.0.0:5555 www-serve:app diff --git a/www-serve.py b/www-serve.py index 34aaa2a..df03e79 100644 --- a/www-serve.py +++ b/www-serve.py @@ -1,7 +1,7 @@ from www import app import logging -logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) if __name__ == "__main__": - app.run(debug=True, use_reloader=False) \ No newline at end of file + app.run(debug=True, use_reloader=False) diff --git a/www/routes.py b/www/routes.py index 5cf5ea5..c182f7a 100644 --- a/www/routes.py +++ b/www/routes.py @@ -3,7 +3,7 @@ from www import app import archive.archive as archive import config from datetime import datetime -import os, logging +import os, logging, time lists_to_serve = archive.list_tables_db(config.db['database'], config.db['host'], config.db['user'], config.db['password']) @@ -46,7 +46,7 @@ def searh(): if f_arg not in ['content', 'from']: return "field '" + f_arg + "' does not exist" - print("annalen /search k_arg=" + k_arg + " l_arg=" + l_arg + " f_arg=" + f_arg) + logging.info("/search k_arg=" + k_arg + " l_arg=" + l_arg + " f_arg=" + f_arg) lists = [] if l_arg == "all": @@ -54,9 +54,6 @@ def searh(): else: lists.append(l_arg) - print(lists) - - ################################ ## ## need to cache all the below..... @@ -67,6 +64,7 @@ def searh(): logging.info("search keyword = " + k_arg) + for l in lists: with archive.Archive(l, config=config.db) as a: @@ -98,6 +96,8 @@ def searh(): sorted_results = sorted(results, key=get_result_key) + + return jsonify(result=sorted_results)