How to secure important data with environments in Python

19 sec read

(Env) ┌─[kubernetes@kubernetes]─[~/Django/django] 
└──╼ $ pip install python-decouple
Requirement already satisfied: python-decouple in /home/kubernetes/Env/lib/python3.6/site-packages

python file

from decouple import config

token = config('SLACK_KEY')
client = WebClient(token=token)
channel_id = config('CHANNEL_ID')

# Server Docker
mydb = mysql.connector.connect(
    host=config('DATABASE_HOST'),
    user=config('DATABASE_USER'),
    passwd=config('DATABASE_PASSWORD'),
    database=config('DATABASE_NAME'),
    port=config('DATABASE_PORT'),
    charset="utf8mb4",
)
mycursor = mydb.cursor()

.env

SLACK_KEY = '****************************************'
CHANNEL_ID = '****************************'
DATABASE_NAME=issue
DATABASE_USER=root
DATABASE_PASSWORD=password
DATABASE_HOST=192.168.8.50
DATABASE_PORT=3306

How to Run Django on Jupyter Notebook Visual Code

previously I have struggled to debug my app when running Python app directly; I need it to run on my Jupyter Workspace easily to...
admin
27 sec read

Custome Setting Database Django

berikut ini macam cara settting database django MAMP Server 2. MYSQL Server (XAMPP) 3. Default
admin
13 sec read

Cara mempercantik Form Django dengan crispy form

agar rendering django tidak terkesan monoton tanpa ada polesan css, tak ubahnya tampilan yang kaku seperti gambar dibawah ini maka dibutuhkan model khusus tanpa...
admin
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *