[extensions-web] cron: use djanjo.setup() before any app references



commit c4b6e1afbedd1beaa11ad58da67c2e76c620756d
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sat Dec 15 12:03:56 2018 +0400

    cron: use djanjo.setup() before any app references

 bin/sweettooth-cron-software | 4 ++--
 bin/sweettooth-cron-update   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/bin/sweettooth-cron-software b/bin/sweettooth-cron-software
index 9ea1d6f..2b3d481 100755
--- a/bin/sweettooth-cron-software
+++ b/bin/sweettooth-cron-software
@@ -12,11 +12,11 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'sweettooth.settings'
 sys.path.extend([os.path.join(_path, '..'),
                  os.path.join(_path, '..', 'sweettooth')])
 
+django.setup()
+
 from django.contrib.staticfiles.storage import staticfiles_storage
 from sweettooth.extensions import models, views
 
-django.setup()
-
 version_qs = models.ExtensionVersion.objects.visible()
 queryset = models.Extension.objects.distinct().filter(versions__in=version_qs)[:1000]
 
diff --git a/bin/sweettooth-cron-update b/bin/sweettooth-cron-update
index 929cb23..428927b 100755
--- a/bin/sweettooth-cron-update
+++ b/bin/sweettooth-cron-update
@@ -12,11 +12,11 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'sweettooth.settings'
 sys.path.extend([os.path.join(_path, '..'),
                  os.path.join(_path, '..', 'sweettooth')])
 
+django.setup()
+
 from django.db.models import Sum
 from sweettooth.extensions.models import Extension
 
-django.setup()
-
 for ext in Extension.objects.all():
     date = datetime.datetime.now()-datetime.timedelta(days=7)
     popularity_data = ext.popularity_items.filter(date__gt=date).aggregate(popularity=Sum('offset'))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]