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 3677668
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:14:58+00:00 2026-05-19T03:14:58+00:00

I had to make a launcher script for my django app, and it seems

  • 0

I had to make a launcher script for my django app, and it seems it somehow switches the timezone to GMT (default being +2), and every datetime is two hours behind when using the script. What could be causing that?

Here is the launcher script that I use:

#!/usr/bin/env python

import os
import subprocess
import shlex
import time

cwd = os.getcwd()

p1 = subprocess.Popen(shlex.split("python manage.py runserver"),
        cwd=os.path.join(cwd, "drugsworld"))
p2 = subprocess.Popen(shlex.split("python coffee_auto_compiler.py"),
        cwd=os.path.join(cwd))

try:
    while True:
        time.sleep(2)
except KeyboardInterrupt:
    p1.terminate()
    p2.terminate()

If I manually run python manage.py runserver, the timezone is +2. If, however, I use this script, the timezone is set to GMT.

  • 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-19T03:14:59+00:00Added an answer on May 19, 2026 at 3:14 am

    Hmm. Python respects the TZ environment variable… you’re not changing it in your script, so it should be equivalent to running it at the shell.

    I often set the time zone explicitly. In Django specifically, you can set this in the settings.py file (TIME_ZONE). More general python is:

    os.environ['TZ']="America/New_York"
    time.tzset()
    

    I imagine if you set the timezone in your settings file, the problem will go away.

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

Sidebar

Related Questions

I had to make a really small and simple script that would fill a
I had make a simple app into a facebook page and I just want
I have had to make changes to a trigger and assumed that running an
Had to download Command Line Tools from Apple to get make to work, but
I had more database and I tried to make backup for them but they
i had soulation .i want to make navigation bar with items i will select
I had a huge problem and spend hours trying to make it work, but
I recently had an idea to create my own String class to make using
I've had trouble writing this code. I'm supposed to make a function that can
Just wondering if you had any thoughts on this problem. I want to make

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.