dotenv 라이브러리

Published by onesixx on

설치

$ conda install -c conda-forge python-dotenv

활용

DB Url을 감추기 위해 주로 사용

from dotenv import load_dotenv
import os 

config = load_dotenv(".env")
# from dotenv import dotenv_values
# config = dotenv_values(".env") 

dbip = os.environ.get("IP")
telegraf_TOKEN = os.getenv('Telegraf_token')

/environment/.env.development 파일 만들고,

HOST=127.0.0.1
PORT=8085
DEBUG=True
DEV_TOOLS_PROPS_CHECK=True
.env.development 

Categories: Python Basic

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x