Questions tagged [python-dotenv]

For questions related to `python-dotenv` library which reads the key-value pair from `.env` file and adds them to the environment variable.

Library Pypi page: https://pypi.org/project/python-dotenv/

There are plenty of alternative implementations: https://pypi.org/search/?q=dotenv

Other runtimes:

39 questions
0
votes
1 answer

How to check wether a python-dotenv creates the environmet variable?

I am novice in IT. Sorry for possible stupid question. I want to check wether python-dotenv really creates environment variable. So I add .env file with my MYVAR. Then I execute python file within code: import dotenv; dotenv.load_dotenv(); import…
0
votes
1 answer

How to use .env file with a json containing a backslash?

Background, I have a MSSQL server database that uses a specific instances, hence the connect string/engine to this database would look like…
Scott Boston
  • 147,308
  • 15
  • 139
  • 187
0
votes
0 answers

What `**config` does with dot_env values

i have .env file and I am importing it with: from dotenv import dotenv_values config = dotenv_values('{}/.env") and using this config as **config But i need to add my key, values in my .env but when I do this the code failt to run. I think this is…
pouchewar
  • 399
  • 1
  • 10
0
votes
4 answers

Django os.getenv('SECRET_KEY') throwing "The SECRET_KEY setting must not be empty."

I'm setting up Django using os.getenv to prepare it for deploying using Docker but it seems it is not reading the .env file. Any idea why is not reading it? Here is the…
Rodragon
  • 135
  • 3
  • 12
-1
votes
1 answer

I get UnicodeDecodeError while running Flask

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 0: invalid start byte while I tried to start a Flask Server. The following is the code from flask import Flask app = Flask(__name__) app.run(debug=True, port=5000) This generates…
Danwand N S
  • 172
  • 1
  • 10
-1
votes
1 answer

Use environment variable in python command

I have a Python script that interrogates a thermocouple HAT connected to a Raspberry Pi. I am now trying to use .env files so that I can use the same script across multiple systems. I'm having problem with one section of code where the environment…
-1
votes
1 answer

Load environment variables in python

Trying to load environment varibles in python module import os class Config(object): port = os.environ.get("PORT") or 5000 print(Config.port) $ 5000
Felix Orinda
  • 593
  • 4
  • 20
-1
votes
1 answer

Reading .env in multiple files [Python]

I have abstracted the reading of the .env file to settings.py but I'm not sure if this is idiomatic to python: # .env SECRET=XXXX # settings.py import os from os.path import join, dirname from dotenv import load_dotenv dotenv_path =…
timothyylim
  • 1,399
  • 2
  • 14
  • 32
-2
votes
1 answer

OSError: Starting path not found (dotenv-0.21.0-py3.9.egg)

I'm developing a script in Python 3.9 that works perfectly on my personal PC. When I tried moving and running it on a server, which has an older python version, it gives me the following error: Does anyone know how to fix this error? I tried to…
1 2
3