Skip to content

Commit

Permalink
fix(db_essentials): now automatically creates the secrets.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjeannesson committed Feb 21, 2024
1 parent 750904e commit 0d4c6c6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions django_napse/core/db_essentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ def create_accounts(sender, **kwargs):
Exchange = apps.get_model("django_napse_core", "Exchange")
from django_napse.core.models.accounts.exchange import EXCHANGE_ACCOUNT_DICT

with open(settings.NAPSE_SECRETS_FILE_PATH, "r") as json_file:
secrets = json.load(json_file)
try:
with open(settings.NAPSE_SECRETS_FILE_PATH, "r") as json_file:
secrets = json.load(json_file)
except FileNotFoundError:
with open(settings.NAPSE_SECRETS_FILE_PATH, "w") as json_file:
json.dump({"Exchange Accounts": {}}, json_file)
secrets = {"Exchange Accounts": {}}
created_exchange_accounts = []

with atomic():
Expand Down

0 comments on commit 0d4c6c6

Please sign in to comment.