There may be another application setting the time zone, but my question
still remains as to why the admin  page is getting the correct time but the
view is not.

Brian


On Tue, Nov 10, 2009 at 7:45 PM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:

>
>
>
> On Nov 11, 10:41 am, BEC <chapma...@gmail.com> wrote:
> > I have a Django application running with mod_python on Apache. In
> > settings.py I have set TIME_ZONE="America/New_York". Within my
> > application I verify that os.environ['TZ'] is indeed set to this
> > value. Within my view.py I use datetime.datetime.now() to create a
> > time stamp that is stored in a model as a DateTimeField and viewed on
> > a rendered html page.
> >
> > However, the times that I generate in my view are all off from what
> > they should be by five hours. I've changed the time zone around
> > "America/Chicago", "America/Anchorage" etc. no matter what I set
> > TIME_ZONE to, I get the same wrong time (5 hours off).
> >
> > If I go to the admin page and use the change entry page to modify the
> > values stored in the database, the Time now link gives the correct
> > time?
> >
> > Any idea on what is going on here? I'm particularly perplexed as to
> > why the admin page and my view are giving different times.
>
> Do you run other Python or PHP applications in the same Apache? If you
> do they likely have conflicting time zone requires.
>
> The problem here is that TZ is a process wide setting and can only be
> set to one value at a time. Thus, whatever application got to set it
> last will take precedence.
>
> See:
>
>
> http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Timezone_and_Locale_Settings
>
> Use mod_wsgi daemon mode or fastcgi solutions, both of which can run
> applications in their own processes if you are being afflicted with
> this problem.
>
> Graham
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to