django-extensions/django-extensions — pull request #267 by kylegibson (2012-11-20 12:09:54+00:00)
Title: ImportError: cannot import name timezone in django 1.3

```
$ ./manage.py runjob --traceback cache_cleanup
ERROR OCCURED IN JOB: cache_cleanup (APP: None)
START TRACEBACK:
Traceback (most recent call last):
File "/home/env/lib/python2.6/site-packages/django_extensions/management/commands/runjob.py", line 31, in runjob
job().execute()
File "/home/env/lib/python2.6/site-packages/django_extensions/jobs/daily/cache_cleanup.py", line 22, in execute
from django.utils import timezone
ImportError: cannot import name timezone
END TRACEBACK
```

`django.utils.timezone` was not added until django 1.3.

```
In [1]: from django.core.management import setup_environ
In [2]: import settings
In [3]: setup_environ(settings)
In [4]: from django.conf import settings as foo
In [5]: foo.CACHES
Out[5]:
{'default': {'BACKEND': 'django.core.cache.backends.memcached.CacheClass',
'LOCATION': 'xxx'}}
```

The hasattr check on [cache_cleanup.py#L19](https://github.com/django-extensions/django-extensions/blob/master/django_extensions/jobs/daily/cache_cleanup.py#L19) passes in our environment, even in django 1.3.

It's also worth noting that we have a CACHE_BACKEND as well, so perhaps the solution here is to check for that first.