From 340402b2221501a82fb20e78c0908a753cc9f122 Mon Sep 17 00:00:00 2001 From: "thomas.woehlke" <thomas.woehlke@rub.de> Date: Sun, 24 Jan 2021 18:03:38 +0100 Subject: [PATCH] Default task --- covid19python.py | 0 covid19python/__init__.py | 27 ++++++++++++++ {static => covid19python/static}/favicon.ico | Bin .../templates}/admin/admin_info.html | 0 .../templates}/admin/admin_tasks.html | 0 .../europe/europe_continent_all.html | 0 .../europe/europe_continent_germany.html | 0 .../europe/europe_continent_one.html | 0 .../templates}/europe/europe_country_all.html | 0 .../europe/europe_country_germany.html | 0 .../templates}/europe/europe_country_one.html | 0 .../templates}/europe/europe_data.html | 0 .../europe/europe_date_reported_all.html | 0 .../europe/europe_date_reported_one.html | 0 ...europe_date_reported_one_cases_weekly.html | 0 ...urope_date_reported_one_deaths_weekly.html | 0 ...e_date_reported_one_notification_rate.html | 0 .../templates}/europe/europe_imported.html | 0 .../templates}/europe/europe_info.html | 0 .../templates}/europe/europe_tasks.html | 0 .../fragment_europe_continent_table.html | 0 .../europe/fragment_europe_country_table.html | 0 .../fragment_europe_data_imported_table.html | 0 .../europe/fragment_europe_data_table.html | 0 .../fragment_europe_date_reported_table.html | 0 .../templates}/fragment_flashed_messages.html | 0 .../templates}/fragment_navbar.html | 0 .../templates}/fragment_navtabs.html | 0 .../templates}/fragment_navtabs_admin.html | 0 .../templates}/fragment_navtabs_europe.html | 0 .../templates}/fragment_navtabs_nrw.html | 0 .../templates}/fragment_navtabs_rki.html | 0 .../fragment_navtabs_vaccination.html | 0 .../templates}/fragment_navtabs_who.html | 0 .../templates}/fragment_pagination.html | 0 .../templates}/nrw/nrw_imported.html | 0 .../templates}/nrw/nrw_info.html | 0 .../templates}/nrw/nrw_stadt.html | 0 .../templates}/nrw/nrw_tasks.html | 0 .../templates}/page_home.html | 0 .../templates}/page_layout.html | 0 .../templates}/rki/rki_imported.html | 0 .../templates}/rki/rki_info.html | 0 .../templates}/rki/rki_tasks.html | 0 .../vaccination/vaccination_imported.html | 0 .../vaccination/vaccination_info.html | 0 .../vaccination/vaccination_tasks.html | 0 .../who/fragment_who_country_table.html | 0 .../who/fragment_who_global_data_table.html | 0 .../templates}/who/who_country_all.html | 0 .../templates}/who/who_country_germany.html | 0 .../templates}/who/who_country_one.html | 0 .../templates}/who/who_date_reported_all.html | 0 .../templates}/who/who_date_reported_one.html | 0 .../templates}/who/who_imported.html | 0 .../templates}/who/who_info.html | 0 .../templates}/who/who_region_all.html | 0 .../templates}/who/who_region_one.html | 0 .../templates}/who/who_tasks.html | 0 app.py => covid19python/views.py | 35 ++++++------------ app_mq.py => covid19python_mq.py | 0 run.sh | 5 +++ setup.cfg | 4 +- 63 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 covid19python.py create mode 100644 covid19python/__init__.py rename {static => covid19python/static}/favicon.ico (100%) rename {templates => covid19python/templates}/admin/admin_info.html (100%) rename {templates => covid19python/templates}/admin/admin_tasks.html (100%) rename {templates => covid19python/templates}/europe/europe_continent_all.html (100%) rename {templates => covid19python/templates}/europe/europe_continent_germany.html (100%) rename {templates => covid19python/templates}/europe/europe_continent_one.html (100%) rename {templates => covid19python/templates}/europe/europe_country_all.html (100%) rename {templates => covid19python/templates}/europe/europe_country_germany.html (100%) rename {templates => covid19python/templates}/europe/europe_country_one.html (100%) rename {templates => covid19python/templates}/europe/europe_data.html (100%) rename {templates => covid19python/templates}/europe/europe_date_reported_all.html (100%) rename {templates => covid19python/templates}/europe/europe_date_reported_one.html (100%) rename {templates => covid19python/templates}/europe/europe_date_reported_one_cases_weekly.html (100%) rename {templates => covid19python/templates}/europe/europe_date_reported_one_deaths_weekly.html (100%) rename {templates => covid19python/templates}/europe/europe_date_reported_one_notification_rate.html (100%) rename {templates => covid19python/templates}/europe/europe_imported.html (100%) rename {templates => covid19python/templates}/europe/europe_info.html (100%) rename {templates => covid19python/templates}/europe/europe_tasks.html (100%) rename {templates => covid19python/templates}/europe/fragment_europe_continent_table.html (100%) rename {templates => covid19python/templates}/europe/fragment_europe_country_table.html (100%) rename {templates => covid19python/templates}/europe/fragment_europe_data_imported_table.html (100%) rename {templates => covid19python/templates}/europe/fragment_europe_data_table.html (100%) rename {templates => covid19python/templates}/europe/fragment_europe_date_reported_table.html (100%) rename {templates => covid19python/templates}/fragment_flashed_messages.html (100%) rename {templates => covid19python/templates}/fragment_navbar.html (100%) rename {templates => covid19python/templates}/fragment_navtabs.html (100%) rename {templates => covid19python/templates}/fragment_navtabs_admin.html (100%) rename {templates => covid19python/templates}/fragment_navtabs_europe.html (100%) rename {templates => covid19python/templates}/fragment_navtabs_nrw.html (100%) rename {templates => covid19python/templates}/fragment_navtabs_rki.html (100%) rename {templates => covid19python/templates}/fragment_navtabs_vaccination.html (100%) rename {templates => covid19python/templates}/fragment_navtabs_who.html (100%) rename {templates => covid19python/templates}/fragment_pagination.html (100%) rename {templates => covid19python/templates}/nrw/nrw_imported.html (100%) rename {templates => covid19python/templates}/nrw/nrw_info.html (100%) rename {templates => covid19python/templates}/nrw/nrw_stadt.html (100%) rename {templates => covid19python/templates}/nrw/nrw_tasks.html (100%) rename {templates => covid19python/templates}/page_home.html (100%) rename {templates => covid19python/templates}/page_layout.html (100%) rename {templates => covid19python/templates}/rki/rki_imported.html (100%) rename {templates => covid19python/templates}/rki/rki_info.html (100%) rename {templates => covid19python/templates}/rki/rki_tasks.html (100%) rename {templates => covid19python/templates}/vaccination/vaccination_imported.html (100%) rename {templates => covid19python/templates}/vaccination/vaccination_info.html (100%) rename {templates => covid19python/templates}/vaccination/vaccination_tasks.html (100%) rename {templates => covid19python/templates}/who/fragment_who_country_table.html (100%) rename {templates => covid19python/templates}/who/fragment_who_global_data_table.html (100%) rename {templates => covid19python/templates}/who/who_country_all.html (100%) rename {templates => covid19python/templates}/who/who_country_germany.html (100%) rename {templates => covid19python/templates}/who/who_country_one.html (100%) rename {templates => covid19python/templates}/who/who_date_reported_all.html (100%) rename {templates => covid19python/templates}/who/who_date_reported_one.html (100%) rename {templates => covid19python/templates}/who/who_imported.html (100%) rename {templates => covid19python/templates}/who/who_info.html (100%) rename {templates => covid19python/templates}/who/who_region_all.html (100%) rename {templates => covid19python/templates}/who/who_region_one.html (100%) rename {templates => covid19python/templates}/who/who_tasks.html (100%) rename app.py => covid19python/views.py (95%) rename app_mq.py => covid19python_mq.py (100%) create mode 100644 run.sh diff --git a/covid19python.py b/covid19python.py new file mode 100644 index 00000000..e69de29b diff --git a/covid19python/__init__.py b/covid19python/__init__.py new file mode 100644 index 00000000..3638a0a5 --- /dev/null +++ b/covid19python/__init__.py @@ -0,0 +1,27 @@ +from logging.config import dictConfig +from database import db, app, my_logging_config, run_run_with_debug +from org.woehlke.covid19.who.who_service import WhoService +from org.woehlke.covid19.europe.europe_service import EuropeService +from org.woehlke.covid19.vaccination.vaccination_service import VaccinationService +from org.woehlke.covid19.admin.admin_service import AdminService + +drop_and_create_data_again = True + +who_service = None +europe_service = None +vaccination_service = None +admin_service = None + +################################################################################################################# +# +# MAIN +# +################################################################################################################# +if __name__ == '__main__': + dictConfig(my_logging_config) + db.create_all() + who_service = WhoService(db) + europe_service = EuropeService(db) + vaccination_service = VaccinationService(db) + admin_service = AdminService(db) + app.run(debug=run_run_with_debug) diff --git a/static/favicon.ico b/covid19python/static/favicon.ico similarity index 100% rename from static/favicon.ico rename to covid19python/static/favicon.ico diff --git a/templates/admin/admin_info.html b/covid19python/templates/admin/admin_info.html similarity index 100% rename from templates/admin/admin_info.html rename to covid19python/templates/admin/admin_info.html diff --git a/templates/admin/admin_tasks.html b/covid19python/templates/admin/admin_tasks.html similarity index 100% rename from templates/admin/admin_tasks.html rename to covid19python/templates/admin/admin_tasks.html diff --git a/templates/europe/europe_continent_all.html b/covid19python/templates/europe/europe_continent_all.html similarity index 100% rename from templates/europe/europe_continent_all.html rename to covid19python/templates/europe/europe_continent_all.html diff --git a/templates/europe/europe_continent_germany.html b/covid19python/templates/europe/europe_continent_germany.html similarity index 100% rename from templates/europe/europe_continent_germany.html rename to covid19python/templates/europe/europe_continent_germany.html diff --git a/templates/europe/europe_continent_one.html b/covid19python/templates/europe/europe_continent_one.html similarity index 100% rename from templates/europe/europe_continent_one.html rename to covid19python/templates/europe/europe_continent_one.html diff --git a/templates/europe/europe_country_all.html b/covid19python/templates/europe/europe_country_all.html similarity index 100% rename from templates/europe/europe_country_all.html rename to covid19python/templates/europe/europe_country_all.html diff --git a/templates/europe/europe_country_germany.html b/covid19python/templates/europe/europe_country_germany.html similarity index 100% rename from templates/europe/europe_country_germany.html rename to covid19python/templates/europe/europe_country_germany.html diff --git a/templates/europe/europe_country_one.html b/covid19python/templates/europe/europe_country_one.html similarity index 100% rename from templates/europe/europe_country_one.html rename to covid19python/templates/europe/europe_country_one.html diff --git a/templates/europe/europe_data.html b/covid19python/templates/europe/europe_data.html similarity index 100% rename from templates/europe/europe_data.html rename to covid19python/templates/europe/europe_data.html diff --git a/templates/europe/europe_date_reported_all.html b/covid19python/templates/europe/europe_date_reported_all.html similarity index 100% rename from templates/europe/europe_date_reported_all.html rename to covid19python/templates/europe/europe_date_reported_all.html diff --git a/templates/europe/europe_date_reported_one.html b/covid19python/templates/europe/europe_date_reported_one.html similarity index 100% rename from templates/europe/europe_date_reported_one.html rename to covid19python/templates/europe/europe_date_reported_one.html diff --git a/templates/europe/europe_date_reported_one_cases_weekly.html b/covid19python/templates/europe/europe_date_reported_one_cases_weekly.html similarity index 100% rename from templates/europe/europe_date_reported_one_cases_weekly.html rename to covid19python/templates/europe/europe_date_reported_one_cases_weekly.html diff --git a/templates/europe/europe_date_reported_one_deaths_weekly.html b/covid19python/templates/europe/europe_date_reported_one_deaths_weekly.html similarity index 100% rename from templates/europe/europe_date_reported_one_deaths_weekly.html rename to covid19python/templates/europe/europe_date_reported_one_deaths_weekly.html diff --git a/templates/europe/europe_date_reported_one_notification_rate.html b/covid19python/templates/europe/europe_date_reported_one_notification_rate.html similarity index 100% rename from templates/europe/europe_date_reported_one_notification_rate.html rename to covid19python/templates/europe/europe_date_reported_one_notification_rate.html diff --git a/templates/europe/europe_imported.html b/covid19python/templates/europe/europe_imported.html similarity index 100% rename from templates/europe/europe_imported.html rename to covid19python/templates/europe/europe_imported.html diff --git a/templates/europe/europe_info.html b/covid19python/templates/europe/europe_info.html similarity index 100% rename from templates/europe/europe_info.html rename to covid19python/templates/europe/europe_info.html diff --git a/templates/europe/europe_tasks.html b/covid19python/templates/europe/europe_tasks.html similarity index 100% rename from templates/europe/europe_tasks.html rename to covid19python/templates/europe/europe_tasks.html diff --git a/templates/europe/fragment_europe_continent_table.html b/covid19python/templates/europe/fragment_europe_continent_table.html similarity index 100% rename from templates/europe/fragment_europe_continent_table.html rename to covid19python/templates/europe/fragment_europe_continent_table.html diff --git a/templates/europe/fragment_europe_country_table.html b/covid19python/templates/europe/fragment_europe_country_table.html similarity index 100% rename from templates/europe/fragment_europe_country_table.html rename to covid19python/templates/europe/fragment_europe_country_table.html diff --git a/templates/europe/fragment_europe_data_imported_table.html b/covid19python/templates/europe/fragment_europe_data_imported_table.html similarity index 100% rename from templates/europe/fragment_europe_data_imported_table.html rename to covid19python/templates/europe/fragment_europe_data_imported_table.html diff --git a/templates/europe/fragment_europe_data_table.html b/covid19python/templates/europe/fragment_europe_data_table.html similarity index 100% rename from templates/europe/fragment_europe_data_table.html rename to covid19python/templates/europe/fragment_europe_data_table.html diff --git a/templates/europe/fragment_europe_date_reported_table.html b/covid19python/templates/europe/fragment_europe_date_reported_table.html similarity index 100% rename from templates/europe/fragment_europe_date_reported_table.html rename to covid19python/templates/europe/fragment_europe_date_reported_table.html diff --git a/templates/fragment_flashed_messages.html b/covid19python/templates/fragment_flashed_messages.html similarity index 100% rename from templates/fragment_flashed_messages.html rename to covid19python/templates/fragment_flashed_messages.html diff --git a/templates/fragment_navbar.html b/covid19python/templates/fragment_navbar.html similarity index 100% rename from templates/fragment_navbar.html rename to covid19python/templates/fragment_navbar.html diff --git a/templates/fragment_navtabs.html b/covid19python/templates/fragment_navtabs.html similarity index 100% rename from templates/fragment_navtabs.html rename to covid19python/templates/fragment_navtabs.html diff --git a/templates/fragment_navtabs_admin.html b/covid19python/templates/fragment_navtabs_admin.html similarity index 100% rename from templates/fragment_navtabs_admin.html rename to covid19python/templates/fragment_navtabs_admin.html diff --git a/templates/fragment_navtabs_europe.html b/covid19python/templates/fragment_navtabs_europe.html similarity index 100% rename from templates/fragment_navtabs_europe.html rename to covid19python/templates/fragment_navtabs_europe.html diff --git a/templates/fragment_navtabs_nrw.html b/covid19python/templates/fragment_navtabs_nrw.html similarity index 100% rename from templates/fragment_navtabs_nrw.html rename to covid19python/templates/fragment_navtabs_nrw.html diff --git a/templates/fragment_navtabs_rki.html b/covid19python/templates/fragment_navtabs_rki.html similarity index 100% rename from templates/fragment_navtabs_rki.html rename to covid19python/templates/fragment_navtabs_rki.html diff --git a/templates/fragment_navtabs_vaccination.html b/covid19python/templates/fragment_navtabs_vaccination.html similarity index 100% rename from templates/fragment_navtabs_vaccination.html rename to covid19python/templates/fragment_navtabs_vaccination.html diff --git a/templates/fragment_navtabs_who.html b/covid19python/templates/fragment_navtabs_who.html similarity index 100% rename from templates/fragment_navtabs_who.html rename to covid19python/templates/fragment_navtabs_who.html diff --git a/templates/fragment_pagination.html b/covid19python/templates/fragment_pagination.html similarity index 100% rename from templates/fragment_pagination.html rename to covid19python/templates/fragment_pagination.html diff --git a/templates/nrw/nrw_imported.html b/covid19python/templates/nrw/nrw_imported.html similarity index 100% rename from templates/nrw/nrw_imported.html rename to covid19python/templates/nrw/nrw_imported.html diff --git a/templates/nrw/nrw_info.html b/covid19python/templates/nrw/nrw_info.html similarity index 100% rename from templates/nrw/nrw_info.html rename to covid19python/templates/nrw/nrw_info.html diff --git a/templates/nrw/nrw_stadt.html b/covid19python/templates/nrw/nrw_stadt.html similarity index 100% rename from templates/nrw/nrw_stadt.html rename to covid19python/templates/nrw/nrw_stadt.html diff --git a/templates/nrw/nrw_tasks.html b/covid19python/templates/nrw/nrw_tasks.html similarity index 100% rename from templates/nrw/nrw_tasks.html rename to covid19python/templates/nrw/nrw_tasks.html diff --git a/templates/page_home.html b/covid19python/templates/page_home.html similarity index 100% rename from templates/page_home.html rename to covid19python/templates/page_home.html diff --git a/templates/page_layout.html b/covid19python/templates/page_layout.html similarity index 100% rename from templates/page_layout.html rename to covid19python/templates/page_layout.html diff --git a/templates/rki/rki_imported.html b/covid19python/templates/rki/rki_imported.html similarity index 100% rename from templates/rki/rki_imported.html rename to covid19python/templates/rki/rki_imported.html diff --git a/templates/rki/rki_info.html b/covid19python/templates/rki/rki_info.html similarity index 100% rename from templates/rki/rki_info.html rename to covid19python/templates/rki/rki_info.html diff --git a/templates/rki/rki_tasks.html b/covid19python/templates/rki/rki_tasks.html similarity index 100% rename from templates/rki/rki_tasks.html rename to covid19python/templates/rki/rki_tasks.html diff --git a/templates/vaccination/vaccination_imported.html b/covid19python/templates/vaccination/vaccination_imported.html similarity index 100% rename from templates/vaccination/vaccination_imported.html rename to covid19python/templates/vaccination/vaccination_imported.html diff --git a/templates/vaccination/vaccination_info.html b/covid19python/templates/vaccination/vaccination_info.html similarity index 100% rename from templates/vaccination/vaccination_info.html rename to covid19python/templates/vaccination/vaccination_info.html diff --git a/templates/vaccination/vaccination_tasks.html b/covid19python/templates/vaccination/vaccination_tasks.html similarity index 100% rename from templates/vaccination/vaccination_tasks.html rename to covid19python/templates/vaccination/vaccination_tasks.html diff --git a/templates/who/fragment_who_country_table.html b/covid19python/templates/who/fragment_who_country_table.html similarity index 100% rename from templates/who/fragment_who_country_table.html rename to covid19python/templates/who/fragment_who_country_table.html diff --git a/templates/who/fragment_who_global_data_table.html b/covid19python/templates/who/fragment_who_global_data_table.html similarity index 100% rename from templates/who/fragment_who_global_data_table.html rename to covid19python/templates/who/fragment_who_global_data_table.html diff --git a/templates/who/who_country_all.html b/covid19python/templates/who/who_country_all.html similarity index 100% rename from templates/who/who_country_all.html rename to covid19python/templates/who/who_country_all.html diff --git a/templates/who/who_country_germany.html b/covid19python/templates/who/who_country_germany.html similarity index 100% rename from templates/who/who_country_germany.html rename to covid19python/templates/who/who_country_germany.html diff --git a/templates/who/who_country_one.html b/covid19python/templates/who/who_country_one.html similarity index 100% rename from templates/who/who_country_one.html rename to covid19python/templates/who/who_country_one.html diff --git a/templates/who/who_date_reported_all.html b/covid19python/templates/who/who_date_reported_all.html similarity index 100% rename from templates/who/who_date_reported_all.html rename to covid19python/templates/who/who_date_reported_all.html diff --git a/templates/who/who_date_reported_one.html b/covid19python/templates/who/who_date_reported_one.html similarity index 100% rename from templates/who/who_date_reported_one.html rename to covid19python/templates/who/who_date_reported_one.html diff --git a/templates/who/who_imported.html b/covid19python/templates/who/who_imported.html similarity index 100% rename from templates/who/who_imported.html rename to covid19python/templates/who/who_imported.html diff --git a/templates/who/who_info.html b/covid19python/templates/who/who_info.html similarity index 100% rename from templates/who/who_info.html rename to covid19python/templates/who/who_info.html diff --git a/templates/who/who_region_all.html b/covid19python/templates/who/who_region_all.html similarity index 100% rename from templates/who/who_region_all.html rename to covid19python/templates/who/who_region_all.html diff --git a/templates/who/who_region_one.html b/covid19python/templates/who/who_region_one.html similarity index 100% rename from templates/who/who_region_one.html rename to covid19python/templates/who/who_region_one.html diff --git a/templates/who/who_tasks.html b/covid19python/templates/who/who_tasks.html similarity index 100% rename from templates/who/who_tasks.html rename to covid19python/templates/who/who_tasks.html diff --git a/app.py b/covid19python/views.py similarity index 95% rename from app.py rename to covid19python/views.py index f1079649..8258396b 100644 --- a/app.py +++ b/covid19python/views.py @@ -1,23 +1,25 @@ +from covid19python import app from logging.config import dictConfig from flask import render_template, redirect, url_for, flash from sqlalchemy.exc import OperationalError -from database import db, app, my_logging_config, run_run_with_debug +from database import db, my_logging_config, run_run_with_debug from org.woehlke.covid19.who.who_model import WhoGlobalDataImportTable from org.woehlke.covid19.who.who_model import WhoRegion, WhoCountry, WhoDateReported, WhoGlobalData -from org.woehlke.covid19.who.who_service import WhoService from org.woehlke.covid19.europe.europe_model import EuropeDataImportTable, EuropeDateReported, EuropeContinent from org.woehlke.covid19.europe.europe_model import EuropeCountry, EuropeData +from org.woehlke.covid19.who.who_service import WhoService from org.woehlke.covid19.europe.europe_service import EuropeService from org.woehlke.covid19.vaccination.vaccination_service import VaccinationService -from org.woehlke.covid19.vaccination.vaccination_model import VaccinationDataImportTable from org.woehlke.covid19.admin.admin_service import AdminService -from app_mq import who_run_update_task, who_update_short_task, who_update_initial_task -from app_mq import alive_message_task -from app_mq import europe_update_initial_task -from app_mq import vaccination_update_initial_task -from app_mq import admin_database_drop_create_task +from org.woehlke.covid19.vaccination.vaccination_model import VaccinationDataImportTable + +from covid19python import who_service, europe_service, vaccination_service, admin_service -drop_and_create_data_again = True +from covid19python_mq import who_run_update_task, who_update_short_task, who_update_initial_task +from covid19python_mq import alive_message_task +from covid19python_mq import europe_update_initial_task +from covid19python_mq import vaccination_update_initial_task +from covid19python_mq import admin_database_drop_create_task class ApplicationPage: @@ -578,18 +580,3 @@ def url_admin_database_drop(): admin_database_drop_create_task.apply_async() app.logger.info("url_admin_database_drop [done]") return redirect(url_for('url_admin_tasks')) - - -################################################################################################################# -# -# MAIN -# -################################################################################################################# -if __name__ == '__main__': - dictConfig(my_logging_config) - db.create_all() - who_service = WhoService(db) - europe_service = EuropeService(db) - vaccination_service = VaccinationService(db) - admin_service = AdminService(db) - app.run(debug=run_run_with_debug) diff --git a/app_mq.py b/covid19python_mq.py similarity index 100% rename from app_mq.py rename to covid19python_mq.py diff --git a/run.sh b/run.sh new file mode 100644 index 00000000..342669ce --- /dev/null +++ b/run.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +export FLASK_ENV=development +export FLASK_APP=yourapplication +pip install -e . +flask run diff --git a/setup.cfg b/setup.cfg index 82847682..8d5dd6c2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,9 @@ name = covid19python version = 0.0.11 [options] -packages = covid19python +packages = + covid19python + covid19python_mq install_requires = requests importlib; python_version >= "3.7" -- GitLab