diff --git a/config/locale/ko/LC_MESSAGES/django.mo b/config/locale/ko/LC_MESSAGES/django.mo index cff2e53..7180aaa 100644 Binary files a/config/locale/ko/LC_MESSAGES/django.mo and b/config/locale/ko/LC_MESSAGES/django.mo differ diff --git a/config/locale/ko/LC_MESSAGES/django.po b/config/locale/ko/LC_MESSAGES/django.po index dc12e52..eb0581e 100644 --- a/config/locale/ko/LC_MESSAGES/django.po +++ b/config/locale/ko/LC_MESSAGES/django.po @@ -827,8 +827,8 @@ msgid "fast-api" msgstr "" #: .\templates\home\index.html:140 -msgid "A Python server suitable for microservices based on Message Queue." -msgstr "Message Queue 기반의 마이크로서비스에 적합한 Python 서버" +msgid "A Python server suitable for microservices based on Rest API." +msgstr "Rest API 기반의 마이크로서비스에 적합한 Python 서버" #: .\templates\home\index.html:148 msgid "vue.js" @@ -845,7 +845,7 @@ msgstr "Redis 고급" #: .\templates\home\index.html:158 msgid "" "Implementation of RDB, AOF, Sharding, Consistent Hashing, and Redis Cluster." -msgstr "RDB, AOF, Sharding, Consistent Hashing, Redis Cluster 구현하기" +msgstr "RDB, AOF, Sharding, Consistent Hashing, Redis Cluster 구축하기" #: .\templates\home\index.html:166 msgid "RabbitMQ Advanced" diff --git a/custom_middlewares/common/statistics.py b/custom_middlewares/common/statistics.py index 6813ef8..d41301d 100644 --- a/custom_middlewares/common/statistics.py +++ b/custom_middlewares/common/statistics.py @@ -15,23 +15,30 @@ def __init__(self, get_response): self.get_response = get_response def stats(self, os_info): + today = timezone.now().date() with transaction.atomic(): - count = ConnectionMethodStats.objects.filter( - created_at__day=timezone.now().date().day + # count = ConnectionMethodStats.objects.filter( + # created_at__day=timezone.now().date().day + # ) + # if not count: + # ConnectionMethodStats.objects.create(created_at=timezone.now()) + + stats, created = ConnectionMethodStats.objects.get_or_create( + created_at__date=today ) - if not count: - ConnectionMethodStats.objects.create(created_at=timezone.now()) if "Windows" in os_info: - count.update(win=F("win") + 1) + stats.win = F("win") + 1 elif "mac" in os_info: - count.update(mac=F("mac") + 1) + stats.mac = F("mac") + 1 elif "iPhone" in os_info: - count.update(iph=F("iph") + 1) + stats.iph = F("iph") + 1 elif "Android" in os_info: - count.update(android=F("android") + 1) + stats.android = F("android") + 1 else: - count.update(oth=F("oth") + 1) + stats.oth = F("oth") + 1 + + stats.save() # 변경 사항 저장 def __call__(self, request): if "HTTP_USER_AGENT" in request.META: @@ -50,20 +57,23 @@ def __init__(self, get_response): def __call__(self, request): if "admin" not in request.path: with transaction.atomic(): - count = ConnectionHardwareStats.objects.filter( - created_at__day=timezone.now().date().day + today = timezone.now().date() + # 오늘 날짜의 통계 가져오기 + stats, created = ConnectionHardwareStats.objects.get_or_create( + created_at__date=today ) - if not count: - ConnectionHardwareStats.objects.create(created_at=timezone.now()) + # 사용자 에이전트에 따라 카운트 업데이트 if request.user_agent.is_mobile: - count.update(mobile=F("mobile") + 1) + stats.mobile = F("mobile") + 1 elif request.user_agent.is_tablet: - count.update(tablet=F("tablet") + 1) + stats.tablet = F("tablet") + 1 elif request.user_agent.is_pc: - count.update(pc=F("pc") + 1) + stats.pc = F("pc") + 1 elif request.user_agent.is_bot: - count.update(bot=F("bot") + 1) + stats.bot = F("bot") + 1 + + stats.save() # 변경 사항 저장 response = self.get_response(request) diff --git a/static/images/4_bigdata_back.jpg b/static/images/4_bigdata_back.jpg new file mode 100644 index 0000000..195c1a9 Binary files /dev/null and b/static/images/4_bigdata_back.jpg differ diff --git a/templates/home/index.html b/templates/home/index.html index 731062a..69c2237 100644 --- a/templates/home/index.html +++ b/templates/home/index.html @@ -137,7 +137,7 @@

{% trans "What I am studying, the project I am planning" %}

{% trans "fast-api"%}

-

{% trans "A Python server suitable for microservices based on Message Queue." %}

+

{% trans "A Python server suitable for microservices based on Rest API." %}