One simple method is to have the user set environment variables with their user name and password, and have the python code read those vars and use their values. That way, your user name and password don't have to be checked into the repo.
So I changed my database connect code to this:
# Open database connection
db = MySQLdb.connect("localhost", os.environ['DB_USER'], os.environ['DB_PASSWORD'],
"tempdb" )
Now I need to define environment vars DB_USER and DB_PASSWORD before running the code.
No comments:
Post a Comment