0

To sum up the issue - django sitemaps seems to be using the incorrect timezone when processing dates which make up my urls.

1.) The data in the model:

fixture_datetime = 2016-04-03 06:15:00

2.) timezone in settings -

TIME_ZONE = 'Australia/Sydney'

postgres timezone has also been set to Australia/Sydney

3.) Value stored in Database:

"2016-04-03 06:15:00+10"

4.) The problem is the sitemap is retuning the URL as:

http://127.0.0.1:8000/sports/super-rugby/bulls/cheetahs/2016/04/02/

when it should be as follows as per the above data:

http://127.0.0.1:8000/sports/super-rugby/bulls/cheetahs/2016/04/03/

in the error page it is returning the date as:

"2016-04-03 06:15:00+00"

How can I get the sitemaps to use the correct timezone? Is there a setting i am forgetting?

purchas
  • 349
  • 7
  • 19
  • PLS check settings.py has context_processors w/ : 'django.template.context_processors.tz', and: USE_TZ = True Django tz context processor (django.template.context_processors.tz) The Django tz context processor exposes a data variable related to a project's time zone. This context processor makes the following variable accessible in Django templates: TIME_ZONE.- Contains a project's time zone, based on the TIME_ZONE variable in the settings.py file. – Ohad the Lad Mar 28 '16 at 07:06
  • "2016-04-03 06:15:00+10" is +10 hours of UTC, which makes it that datetime - 10 hours in UTC time, which is in fact 2016-04-02. There is no 'correct' timezone, just the timezone you want it in. Also thing about who is reading the sitemap - probably crawlers - not sure they care about your timezone... – lukeaus Mar 29 '16 at 08:33

0 Answers0