use UTC by default, slow rebuild

This commit is contained in:
j 2011-11-11 00:27:14 +01:00
parent ee9135bf04
commit b333f447f6
2 changed files with 6 additions and 2 deletions

View file

@ -3,6 +3,7 @@
import os import os
from os.path import join, dirname, basename, splitext, exists from os.path import join, dirname, basename, splitext, exists
import time
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError
from django.conf import settings from django.conf import settings
@ -20,11 +21,13 @@ class Command(BaseCommand):
def handle(self, **options): def handle(self, **options):
offset = 0 offset = 0
chunk = 100 chunk = 50
count = pos = models.Item.objects.count() count = pos = models.Item.objects.count()
while offset <= count: while offset <= count:
for i in models.Item.objects.all().order_by('id')[offset:offset+chunk]: for i in models.Item.objects.all().order_by('id')[offset:offset+chunk]:
print pos, i.itemId print pos, i.itemId
i.save() i.save()
time.sleep(1) #dont overload db
pos -= 1 pos -= 1
offset += chunk offset += chunk
time.sleep(30) #dont overload db

View file

@ -24,7 +24,8 @@ MANAGERS = ADMINS
# although not all choices may be available on all operating systems. # although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your # If running in a Windows environment this must be set to the same as your
# system time zone. # system time zone.
TIME_ZONE = 'Europe/Berlin' TIME_ZONE = 'UTC'
#TIME_ZONE = 'Asia/Kolkata' #TIME_ZONE = 'Asia/Kolkata'
# Language code for this installation. All choices can be found here: # Language code for this installation. All choices can be found here: