Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 707131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:14:35+00:00 2026-05-14T04:14:35+00:00

Setup: Multiple sites on Django on the same set of servers, being served by

  • 0

Setup: Multiple sites on Django on the same set of servers, being served by the same group of Apache processes. Some sites are Eastern TZ; some are Central. Database is PSQL running on a separate server.

When I started, I didn’t put much thought into how the various sites would handle timezones; I guess I saw the TIMEZONE setting in Django and just figured it’d ‘handle it’. Now I’m seeing the cracks.

First problem: The timezone seems to flip back and forth between Eastern and Central. My understanding of that from searching around on this site are that it’s because the os environ var for TZ gets set to the Apache process depending on which Django site it’s handling a request for, and if that process then handles a request for a site on another TZ, the timezone is wrong. I believe the solution I found here was that sites of different timezones need to have different process groups serving them. Please correct if wrong.

Second problem: Locally on Linux, I did a ./manage.py runserver from one of my sites with Central time (I’m in Eastern). I created an asset, whose publish date correctly displayed as one hour behind in the admin. Looking at the actual PostgresSQL entry, the publish date’s timezone is still listed as -04. Does Postgres just use the timezone of the server/computer itself and ignore any TZ setting in Django? So all entries saved on a Postgres server on Eastern time would show as -04 or -05 depending on Daylight Savings?

If anyone else has dealt with something like this, advice is appreciated. Even if I split out the Apache processes for the Central sites such that their TZ settings don’t cross, I still have the Postgres problem to deal with. And then I’m curious; if the PSQL timestamp is Central, and the TZ setting is Eastern, say, do the datetime fields take TZ into account? i.e., if you do datetime.datetime.now() when Django is set to EST, and it returns 2:00 PM, then you have it filter content by its publish date being less than that result, would it account for TZ by only looking for content whose publish time was 1:00PM CST or earlier?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:14:36+00:00Added an answer on May 14, 2026 at 4:14 am

    Here are some details on time zone handling in Django and Postgres, but I strongly recommend dealing exclusively with UTC on the backend and only converting to a local time zone in the frontend when presenting a UTC timestamp to a user. In Python, you can get the current time in UTC via datetime.datetime.utcnow(). I even put my servers in the UTC time zone, but that isn’t strictly necessary.

    Multiple time zones don’t work well in Django; see this ticket. The datetime objects in the Python standard library are time zone naive, and you need a library like pytz to fix that, but as far as I know Django still returns naive datetime objects, not the time zone aware ones that you can construct with pytz.

    Postgres will check several places to determine the time zone, including the TZ environment variable, but TZ will have to be in the environment of the postgres process:

    PostgreSQL 8.5.3. Time Zones

    If timezone is not specified in
    postgresql.conf nor as a postmaster
    command-line switch, the server
    attempts to use the value of the TZ
    environment variable as the default
    time zone. If TZ is not defined or is
    not any of the time zone names known
    to PostgreSQL, the server attempts to
    determine the operating system’s
    default time zone by checking the
    behavior of the C library function
    localtime(). The default time zone is
    selected as the closest match among
    PostgreSQL’s known time zones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use a central CI setup for multiple sites. The way I
I have multiple websites set up in the same folder, and I want to
I am trying to setup drupal to host multiple sites which will not effect
I'm trying to set up forms authentication across multiple servers and subdomains. I have
I have an environment where multiple sites hosted on the same server will use
Under the same subdomain, I need to set up several independent sites each running
I'm just about to set up a VPS that will host multiple RoR sites.
I've set up multiple ssl sites on iis using Servier Bindings as per this
I need to setup multiple queues on an exchange. I would like to create
I have setup multiple SQL Service Broker Queues in a database but have not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.