I was using "python-dotenv" but I felt that that would be too heavy for the project and most of the services like Vercel, and Netlify allow us to store .env files and access them via os.getenv. Still, while developing locally, we also need to make sure our environmental system doesn't get polluted. So what should we do? The answer may be a dev-dependency for Poetry which like command-line which takes .env automatically for the particular isolated environment. However, python-dotenv requires the entire module to be installed which may make our project bulky.
#π Looking for alternatives to python-dotenv
8 messages Β· Page 1 of 1 (latest)
@plucky edge
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
I'm not entirely sure I understand your question correctly...
Isn't configparser suitable for this? Reads ini-format config files and is built-in
Vercel and Netlify will crash while reading the config.ini and these services allow us to use environment variables directly without need of python-dotenv (serverless apps)
The whole point is to use a tool to set environment variables that are localized to a particular isolated Python environment which means the environment variables are going to work under this virtual environment only. Python-DotEnv installs with bulky modules which we may not require.
When deploying to a service, it makes no sense to use python-dotenv and load config from .env because they provide native support for storing secrets aka .env details
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.