25 lines
516 B
Python
25 lines
516 B
Python
import json
|
|
|
|
try:
|
|
f = open('./config/config.json')
|
|
data = json.load(f)
|
|
except:
|
|
data = {
|
|
"secret": "SECRET_KEY",
|
|
"database": {
|
|
"ip": "localhost",
|
|
"port": 3306,
|
|
"user": "user",
|
|
"password": "password"
|
|
}
|
|
}
|
|
|
|
json_object = json.dumps(data, indent=4)
|
|
|
|
with open("config/config.json", "w") as outfile:
|
|
outfile.write(json_object)
|
|
|
|
|
|
database = data.get("database");
|
|
secret = data.get("secret")
|