Skip to content

Commit e53e9a3

Browse files
committed
fix build date settings
1 parent da2917c commit e53e9a3

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

project/settings/common.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import os
2-
from datetime import datetime
3-
4-
from django.utils.timezone import make_aware
2+
import datetime
53

64
# AFLABS PROJECT SETTINGS
75
PROJECT_NAME = "UTXO Indexer"
86
PROJECT_SETTINGS = os.environ.get("DJANGO_SETTINGS_MODULE", "project.settings.local")
97
PROJECT_COMMIT_HASH = "local"
108
PROJECT_VERSION = "local"
11-
PROJECT_BUILD_DATE = make_aware(datetime.now()) # noqa: DTZ005
9+
PROJECT_BUILD_DATE = datetime.datetime.now(tz=datetime.UTC).isoformat() # noqa: DTZ005
1210

1311
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
1412
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

project/settings/remote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
try:
4444
with open(os.path.join(BASE_DIR, "PROJECT_BUILD_DATE")) as f:
45-
PROJECT_BUILD_DATE = datetime.fromisoformat(f.read().strip())
45+
PROJECT_BUILD_DATE = f.read().strip()
4646
except FileNotFoundError:
4747
pass
4848

utxo_indexer/management/commands/get_version.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from django.conf import settings
22
from django.core.management.base import BaseCommand
33

4+
from datetime import datetime
45
from configuration.config import config
56
from utxo_indexer.indexer import get_indexer_client
67
from utxo_indexer.models.config import Version
@@ -17,15 +18,15 @@ def handle(self, *args, **options):
1718
"node_version": node_version,
1819
"git_tag": settings.PROJECT_VERSION,
1920
"git_hash": settings.PROJECT_COMMIT_HASH,
20-
"build_date": settings.PROJECT_BUILD_DATE.timestamp(),
21+
"build_date": datetime.fromisoformat(settings.PROJECT_BUILD_DATE).timestamp(),
2122
"num_confirmations": config.NUMBER_OF_BLOCK_CONFIRMATIONS,
2223
"history_seconds": config.PRUNE_KEEP_DAYS * 24 * 60 * 60,
2324
},
2425
create_defaults={
2526
"node_version": node_version,
2627
"git_tag": settings.PROJECT_VERSION,
2728
"git_hash": settings.PROJECT_COMMIT_HASH,
28-
"build_date": settings.PROJECT_BUILD_DATE.timestamp(),
29+
"build_date": datetime.fromisoformat(settings.PROJECT_BUILD_DATE).timestamp(),
2930
"num_confirmations": config.NUMBER_OF_BLOCK_CONFIRMATIONS,
3031
"history_seconds": config.PRUNE_KEEP_DAYS * 24 * 60 * 60,
3132
},

0 commit comments

Comments
 (0)