Commit 580c78c8 authored by Christophe Benz's avatar Christophe Benz
Browse files

Add LOG_LEVEL config key

parent 54339067
# Example config file. Copy and customize this file to ".env". Don't commit ".env".
# For production deployment, see
import json
import logging
import os
from pathlib import Path
from urllib.parse import quote_plus
......@@ -11,9 +12,10 @@ from cachetools.func import ttl_cache
import opendataschema
# Let this import after app initialisation
from . import config
log = logging.getLogger(__name__)
@ttl_cache(maxsize=50, ttl=5*60)
def download_with_cache(url):
......@@ -28,6 +30,7 @@ def schema_from_url(url):
# And load schema catalogs which urls are found in config.json
schema_catalog_map = {}
if config.HOMEPAGE_CONFIG:"Initializing homepage sections...")
for section in config.HOMEPAGE_CONFIG['sections']:
if isinstance(section['catalog'], str) and section['catalog'].startswith('http'):
code = section['code']
import json
import logging
import os
import sys
from pathlib import Path
import requests
......@@ -11,6 +12,15 @@ log = logging.getLogger(__name__)
LOG_LEVEL = os.environ.get("LOG_LEVEL", "INFO")
numeric_log_level = getattr(logging, LOG_LEVEL.upper(), None)
if not isinstance(numeric_log_level, int):
log.error('Invalid log level: {}'.format(LOG_LEVEL))
stream=sys.stderr, # script outputs data
SECRET_KEY = os.environ.get("SECRET_KEY") or None
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment