import secrets,sys from pathlib import Path p=Path(sys.argv[1]);text=p.read_text() text=text.replace('DJANGO_SECRET_KEY=CHANGE_ME_GENERATE_WITH_SECRETS','DJANGO_SECRET_KEY='+secrets.token_urlsafe(64)) text=text.replace('NICEGUI_STORAGE_SECRET=CHANGE_ME_GENERATE_SEPARATELY','NICEGUI_STORAGE_SECRET='+secrets.token_urlsafe(64)) p.write_text(text)