-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tasks will fail when settings.USE_TZ = False #8
Comments
According to this SO question, |
From the Django docs for timezone.now():
By default, USE_TZ = False, which means by default, timezone.now() will not return an aware datetime. |
Oh, so the issue is that a time generated elsewhere is timezone aware, mucking up the comparison? |
Exactly. Here's the first culprit. |
Where's the date that one's being compared to? Also, can you paste a stacktrace? |
The schedule class is where the comparison object is made timezone aware. The comparison is happening in the time_before method of the schedule class. The
|
Ah, so maybe we should only make this guy timezone aware if |
By default, the Django setting USE_TZ = False. This will throw errors when running tasks because this reference to the current time is not timezone aware.
The tests pass because they're bypassing the task running command.
I'm not sure what the best way to handle this is. My thought is that we should require USE_TZ to be True for consistency, and if it's not, throw an assertion error with a clear explanatory message.
I created an additional test in order to test the runner task. It's in a branch tz-issues.
The text was updated successfully, but these errors were encountered: