Reputation: 3560
I need to set some environment variable and it should be fetched inside function and the values will go for save inside the database using Django and Python. My code is below:
def plantsave(request):
rname = request.POST.get('react')
status = request.POST.get('status')
Here I am getting the value by post method but instead of it I need to set the value by using environment variable
and access those values here to submit.
Upvotes: 1
Views: 1400
Reputation: 3623
Perhaps you can use django session
for that, or just define global variable
.
Else :
import os
# set
os.environ["MY_VAR"] = "1"
# get
MY_VAR = os.environ["MY_VAR"]
Upvotes: 0