I have a queryset that lists all sales for today:
from django.utils import timezone
class VentaToday(ListView):
queryset = Venta.objects.filter(fecha=timezone.now()).order_by('-id')
template_name = 'venta/venta_today.html'
In local, this works fine but in production (Pythonanywhere) the sales from the previous day still appear. To solve it, I have to go to the pythonanywhere panel and click the **reload** button to solve the problem, that is, refresh the page and there just the sales from the previous day disappear.
I have tried changing the server time:
And this is the configuration of my settings.py
LANGUAGE_CODE = 'es-pe'
TIME_ZONE = 'America/Lima'
USE_I18N = True
USE_L10N = True
USE_TZ = True
Is it a cache problem on the server? or am I doing something wrong? since that problem does not happen to me locally.
Fixed: First I had to download pytz since the server changes the time zone when doing a maintenance.
Then passing the 12 still didn't update the list... so I had to replace my queryset and return the list with the pytz filter:
Now passing 12AM restart sales again! I hope this helps someone if something similar happens to them.