You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
464 B
18 lines
464 B
fp = open("/django/server/settings.py") |
|
key = "" |
|
for line in fp: |
|
if line.startswith("SECRET_KEY"): |
|
key = line.split(" ")[2] |
|
break |
|
fp.close() |
|
|
|
with open('/django/config/settings.py', 'r') as file: |
|
data = file.readlines() |
|
|
|
for i, line in enumerate(data): |
|
if line.startswith("SECRET_KEY"): |
|
data[i] = "{} = {}".format("SECRET_KEY", key) |
|
break |
|
|
|
with open('/django/config/settings.py', 'w') as file: |
|
file.writelines(data)
|
|
|