diff options
author | Bruno Rocha <rochacbruno@gmail.com> | 2020-10-01 17:00:29 -0300 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2020-10-05 13:50:02 -0700 |
commit | 2944c46c53f4a5b6e8694aa60c5f16070ba5961e (patch) | |
tree | 0159a1165d473a78101e19caa289ae9159b040e9 /fatcat_scholar | |
parent | d3557db18c81da57fd67323068811a1afe86769f (diff) | |
download | fatcat-scholar-2944c46c53f4a5b6e8694aa60c5f16070ba5961e.tar.gz fatcat-scholar-2944c46c53f4a5b6e8694aa60c5f16070ba5961e.zip |
Upgrade Dynaconf to 3+
In dynaconf 3+ it is no more recommended to use `from dynaconf import
settings` now the recommendation is to create your own instance of the
settings object based on Dynaconf class.
Diffstat (limited to 'fatcat_scholar')
-rw-r--r-- | fatcat_scholar/config.py | 4 | ||||
-rw-r--r-- | fatcat_scholar/search.py | 2 | ||||
-rw-r--r-- | fatcat_scholar/transform.py | 2 | ||||
-rw-r--r-- | fatcat_scholar/web.py | 2 | ||||
-rw-r--r-- | fatcat_scholar/work_pipeline.py | 2 |
5 files changed, 8 insertions, 4 deletions
diff --git a/fatcat_scholar/config.py b/fatcat_scholar/config.py new file mode 100644 index 0000000..9a9d529 --- /dev/null +++ b/fatcat_scholar/config.py @@ -0,0 +1,4 @@ +from dynaconf import Dynaconf + + +settings = Dynaconf(settings_file="settings.toml", environments=True,) diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py index d29a720..c15ed93 100644 --- a/fatcat_scholar/search.py +++ b/fatcat_scholar/search.py @@ -8,7 +8,6 @@ from gettext import gettext from typing import List, Optional, Any import elasticsearch -from dynaconf import settings from elasticsearch_dsl import Search, Q # pytype: disable=import-error @@ -16,6 +15,7 @@ from pydantic import BaseModel # pytype: enable=import-error +from fatcat_scholar.config import settings from fatcat_scholar.identifiers import * # i18n note: the use of gettext below doesn't actually do the translation here, diff --git a/fatcat_scholar/transform.py b/fatcat_scholar/transform.py index af794e6..04922ba 100644 --- a/fatcat_scholar/transform.py +++ b/fatcat_scholar/transform.py @@ -3,11 +3,11 @@ import argparse import datetime from typing import List, Dict, Optional, Any, Sequence -from dynaconf import settings from fatcat_openapi_client import ReleaseEntity, FileEntity from fatcat_scholar.api_entities import * from fatcat_scholar.schema import * +from fatcat_scholar.config import settings from fatcat_scholar.grobid2json import teixml2json diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py index b465453..58d282d 100644 --- a/fatcat_scholar/web.py +++ b/fatcat_scholar/web.py @@ -8,9 +8,9 @@ import babel.support from fastapi import FastAPI, APIRouter, Request, Depends, Response from fastapi.staticfiles import StaticFiles from fastapi.responses import PlainTextResponse -from dynaconf import settings from typing import Optional, Any +from fatcat_scholar.config import settings from fatcat_scholar.hacks import Jinja2Templates from fatcat_scholar.search import do_fulltext_search, FulltextQuery, FulltextHits diff --git a/fatcat_scholar/work_pipeline.py b/fatcat_scholar/work_pipeline.py index 720c696..715be1a 100644 --- a/fatcat_scholar/work_pipeline.py +++ b/fatcat_scholar/work_pipeline.py @@ -7,10 +7,10 @@ from typing import List, Dict, Tuple, Optional, Any, Sequence import minio import requests import internetarchive -from dynaconf import settings from fatcat_openapi_client import ReleaseEntity, FileEntity from fatcat_scholar.api_entities import * +from fatcat_scholar.config import settings from fatcat_scholar.djvu import djvu_extract_leaf_texts from fatcat_scholar.sandcrawler import ( SandcrawlerPostgrestClient, |