Skip to content

Instantly share code, notes, and snippets.

@esseti

esseti/config.py Secret

Created Jun 27, 2018
Embed
What would you like to do?
#this goes in settings.py
RAVEN_CONFIG = {
'dsn': env("SENTRY"),
//taken from .env file, use django-environ
'release': env('RELEASE'),
'env': SERVER
}
#function to update the .env file, goes in fabric.py
def update_version(version, file='.env.dev'):
#update the RELASE line with the new version
with open('configs/' + file, 'r+') as f:
lines = f.readlines()
f.seek(0)
f.truncate()
for line in lines:
if line.startswith('RELEASE'):
line = "RELEASE=%s" % version
f.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment