diff --git a/app_urls/README.md b/app_urls/README.md index cdf59ec..5f07183 100644 --- a/app_urls/README.md +++ b/app_urls/README.md @@ -5,7 +5,7 @@ conda activate matitos_urls # Core pip install django psycopg[binary] django-redis django-tasks-scheduler # Fetcher -pip install feedparser python-dateutil newspaper4k lxml[html_clean] googlenewsdecoder gnews duckduckgo_search GoogleNews +pip install feedparser python-dateutil newspaper4k[all] lxml[html_clean] googlenewsdecoder gnews duckduckgo_search GoogleNews # News visualization pip install ollama ``` @@ -110,6 +110,8 @@ http://localhost:8080/?pgsql=matitos_db&username=supermatitos&db=matitos&ns=publ * Scheduled tasks ``` +# 1) Modify the scheduled tasks on the admin panel: + Names: Fetch Feeds, Fetch Parser, Fetch Search Callable: api.tasks.fetch_feeds, api.tasks.fetch_parser, api.tasks.fetch_search Task type: Repetable task (or cron...) @@ -122,6 +124,12 @@ Task type: Repetable task (or cron...) Queue: Low, Low, Default Interval: 1h, 4h, 2h +# 2) Export +# python manage.py export > scheduled_tasks.json + + +# Or simply import saved definitions +python manage.py import --filename scheduled_tasks.json ``` * Utils diff --git a/app_urls/api/src/logger.py b/app_urls/api/src/logger.py index 93a82a4..5eb736c 100644 --- a/app_urls/api/src/logger.py +++ b/app_urls/api/src/logger.py @@ -3,7 +3,9 @@ import os ''' TODO: PATH LOGS PATH_LOGS_ERROR=logs/log_app_fetcher_error.log -PATH_LOGS=logs/log_app_fetcher.log +PATH_LOGS_INFO=logs/log_app_fetcher_info.log +PATH_LOGS_DEBUG=logs/log_app_fetcher_debug.log +# PATH_LOGS=logs/log_app_fetcher.log ''' os.makedirs("logs", exist_ok=True) @@ -11,12 +13,18 @@ logging.basicConfig(format='%(filename)s | %(levelname)s | %(asctime)s | %(messa logger = logging.getLogger("news_fetcher") logger.setLevel(logging.DEBUG) -# To file log: INFO / WARNING / ERROR -fh = logging.handlers.RotatingFileHandler(filename="logs/log_app_fetcher.log", mode="a", maxBytes=10000000, backupCount=4) +# To file log: INFO / WARNING / ERROR / CRITICAL +fh = logging.handlers.RotatingFileHandler(filename="logs/log_app_fetcher_debug.log", mode="a", maxBytes=10000000, backupCount=4) fh.setFormatter(logging.Formatter('%(levelname)s | %(asctime)s | %(message)s')) logger.addHandler(fh) -# To file log: WARNING / ERROR +# To file log: INFO / WARNING / ERROR +fh_ = logging.handlers.RotatingFileHandler(filename="logs/log_app_fetcher_info.log", mode="a", maxBytes=10000000, backupCount=2) +fh_.setFormatter(logging.Formatter('%(levelname)s | %(asctime)s | %(message)s')) +fh_.setLevel(logging.INFO) +logger.addHandler(fh_) + +# To file log: WARNING / ERROR / CRITICAL fh_ = logging.handlers.RotatingFileHandler(filename="logs/log_app_fetcher_error.log", mode="a", maxBytes=10000000, backupCount=1) fh_.setFormatter(logging.Formatter('%(levelname)s | %(asctime)s | %(message)s')) fh_.setLevel(logging.WARNING) diff --git a/app_urls/api/templates/filtered_urls.html b/app_urls/api/templates/filtered_urls.html index 72263ac..9e9eaef 100644 --- a/app_urls/api/templates/filtered_urls.html +++ b/app_urls/api/templates/filtered_urls.html @@ -110,7 +110,7 @@ input[type="checkbox"] { } /* Themed Toggle Button */ -.theme-button { +.theme-button, .home-button { background-color: var(--sidebar); border: 1px solid var(--sidebar); border-radius: 50%; @@ -123,13 +123,70 @@ input[type="checkbox"] { transition: background-color 0.1s, color 0.1s, transform 0.1s; cursor: pointer; } -.theme-button:hover { + +.theme-button:hover, .home-button:hover { transform: rotate(20deg); } -.theme-button:active { +.theme-button:active, .home-button:active { transform: scale(0.95); } +.button-container { + display: flex; + align-items: center; + gap: 10px; /* Space between buttons */ +} + + + + + +/* ROUNDED SWITCH*/ +/* Hide the default checkbox */ +.checkbox-slider { + display: none; +} +/* Container for the toggle switch */ +.slider-container { + display: inline-block; + width: 60px; + height: 30px; + position: relative; +} +/* Label for the slider */ +.slider-container label { + display: block; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: #ccc; + border-radius: 30px; + cursor: pointer; + transition: background-color 0.3s ease; +} +/* The toggle circle */ +.slider-container label::before { + content: ''; + position: absolute; + top: 3px; + left: 3px; + width: 24px; + height: 24px; + background-color: white; + border-radius: 50%; + transition: transform 0.3s ease; +} +/* When the checkbox is checked */ +.checkbox-slider:checked + .slider-container label { + background-color: #0940b8; +} +/* When the checkbox is checked, move the circle */ +.checkbox-slider:checked + .slider-container label::before { + transform: translateX(30px); +} + @@ -137,22 +194,54 @@ input[type="checkbox"] {