Skip to content

Commit

Permalink
Merge pull request #241 from unicef-drp/remove-uwsgi-log
Browse files Browse the repository at this point in the history
Remove uwsgi log
  • Loading branch information
danangmassandy authored Oct 15, 2024
2 parents d4a6a57 + 54ab09c commit 4a0f4fe
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
3 changes: 2 additions & 1 deletion deployment/docker/uwsgi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ env = DJANGO_SETTINGS_MODULE=core.settings.prod
memory-report = true
# increase harakiri timeout to 6mins
harakiri = 300
buffer-size = 8192
buffer-size = 8192
disable-logging=True
3 changes: 2 additions & 1 deletion deployment/docker/uwsgi_auth.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ env = DJANGO_SETTINGS_MODULE=core.settings.prod
# uid = 1000
# gid = 1000
memory-report = true
harakiri = 20
harakiri = 20
disable-logging=True
5 changes: 2 additions & 3 deletions django_project/dashboard/api_views/notification.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from datetime import datetime

from django.db.models import Q
from django.utils import timezone
from rest_framework.response import Response
from rest_framework.views import APIView
from azure_auth.backends import AzureAuthRequiredMixin
Expand Down Expand Up @@ -32,7 +31,7 @@ def get_notification_list(self):
return serializer.data

def get_maintenance(self):
current_datetime = datetime.now()
current_datetime = timezone.now()
maintenance = Maintenance.objects.filter(
scheduled_from_date__lte=current_datetime
).filter(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.0.7 on 2024-10-15 20:14

from django.db import migrations, models
import django.utils.timezone


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0092_layeruploadsession_validation_report_and_more'),
]

operations = [
migrations.AlterField(
model_name='maintenance',
name='scheduled_from_date',
field=models.DateTimeField(default=django.utils.timezone.now),
),
]
4 changes: 2 additions & 2 deletions django_project/dashboard/models/maintenance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db import models
from django.conf import settings
from datetime import datetime
from django.utils import timezone


class Maintenance(models.Model):
Expand All @@ -17,7 +17,7 @@ class Maintenance(models.Model):
)

scheduled_from_date = models.DateTimeField(
default=datetime.now,
default=timezone.now,
null=False,
blank=False
)
Expand Down
2 changes: 1 addition & 1 deletion django_project/dashboard/tests/test_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_notification_list(self):
self.assertEqual(Notification.objects.filter(
recipient=user_2).count(), 1)

@mock.patch('dashboard.api_views.notification.datetime')
@mock.patch('dashboard.api_views.notification.timezone')
def test_check_for_maintenance(self, mocked_datetime):
user_1 = UserF.create()
mocked_datetime.now.return_value = datetime.strptime(
Expand Down

1 comment on commit 4a0f4fe

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report for django_project/dashboard

St.
Category Percentage Covered / Total
🔴 Statements 5.16% 520/10077
🔴 Branches 0.72% 39/5421
🔴 Functions 2.38% 59/2478
🔴 Lines 5.24% 514/9811

Test suite run success

12 tests passing in 5 suites.

Report generated by 🧪jest coverage report action from 4a0f4fe

Please sign in to comment.