Closed ukch closed 9 years ago
Also appears in Django 1.6.5:
/.virtualenvs/my-env/local/lib/python2.7/site-packages/django/db/models/fields/init.py:848: RuntimeWarning: DateTimeField CronJobLog.start_time received a naive datetime (2014-09-11 00:00:00) while time zone support is active. RuntimeWarning)
until it's fixed, you can suppress the warning with:
import warnings
warnings.filterwarnings(u'ignore',
message=u'DateTimeField CronJobLog.start_time received a naive datetime',
category=RuntimeWarning,
)
Fixed in #48
The above warning occurs when running
manage.py runcrons
on Django 1.4. The complete traceback is:This comes from the fact that you are passing a
datetime.date
object to a DateTimeField, which is unsupported. A workaround is to use a timezone-awaredatetime
object (eg. by usingdjango.utils.timezone.now
) and setting the time to midnight.Although this is only a warning, it is causing a large amount of email for us as we have
runcrons
set up to run every five minutes and email us any output from stderr.