Dynaconf can't find settings file when using pytest
See original GitHub issueWhere do I put settings files / How do I configure Dynaconf so it will work with pytest? Currently I get the following error:
AttributeError: 'Settings' object has no attribute 'LOGGING'
It seems like Dynaconf is looking for the files in the tree the python command was invoked from and not relative the module itself.
Here is how my project structure (simplified) looks like:
.
βββ ...
βββ project
β βββ app.py
β βββ conf.py
β βββ __init__.py
β βββ settings.toml
βββ tests
βββ conftest.py
βββ test_app.py
My conf.py
:
from dynaconf import Dynaconf
settings = Dynaconf(
envvar_prefix="DYNACONF", settings_files=["settings.toml", ".secrets.toml"],
)
Thanks in advance
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Dynaconf can't find settings file when using pytest #374 - GitHub
It seems like Dynaconf is looking for the files in the tree the python command was invoked from and not relative the module...
Read more >Testing β dynaconf 2.2.3 documentation - Read the Docs
For pytest it is common to create fixtures to provide pre-configured settings object or to configure the settings before all the tests are...
Read more >Settings files - Dynaconf - 3.1.11
Settings file location ΒΆ ... Dynaconf will search files specified in settings_file option starting the search tree on the current working dir (theΒ ......
Read more >Are config settings loaded separately into each Python ...
In this answer, I was told that the logger needed to only be declared once globally. On similar lines, how are program configuration...
Read more >Settings and Environment Variables - FastAPI
But a dotenv file doesn't really have to have that exact filename. Pydantic has support for reading from these types of files using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh well I found a solution.
I will keep this issue open for a bit, maybe I can get feedback if this is an appropriate solution or not
Does it mean we need a fix in the documentation so the others who start working with it do not have to spend few ours figuring it out as I did?