Skip to content

Instantly share code, notes, and snippets.

@AlexandreProenca
Last active September 12, 2015 13:47
Show Gist options
  • Save AlexandreProenca/caa7ae4914d8bebd0dc7 to your computer and use it in GitHub Desktop.
Save AlexandreProenca/caa7ae4914d8bebd0dc7 to your computer and use it in GitHub Desktop.
with open(args.project_name + r'/settings.py', 'wt') as fout:
with open(resource_filename('robot_rest', 'settings.tpl'), 'rt') as fin:
for line in fin:
if '@projeto@' in line:
fout.write(line.replace('@projeto@', args.project_name))
elif '@HOST@' in line:
fout.write(line.replace('@HOST@', args.database_host))
elif '@USER@' in line:
fout.write(line.replace('@USER@', args.database_user))
elif '@PASSWORD@' in line:
fout.write(line.replace('@PASSWORD@', args.database_password))
elif '@NAME@' in line:
fout.write(line.replace('@NAME@', args.database_name))
else:
fout.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment