Forums

Schduled task : Django version is different from the one in my virtualenv

These days, I have wrote some posts involved in scheduled task.

I'm now having the error from 'push_notifications':

AttributeError: 'module' object has no attribute 'UUIDField'

After searching for troubleshooting, it was because of django version. UUIDField is provided with Django with 1.8 version. My scheduled task script.py shows me the version of django is 1.6.6.

But when I typed django.version() at the bash after activating my virtualenv , it shows me 1.9.2.

Furthermore, after deactivating my virtualenv, it shows me 1.37...

So where does the django with version 1.6.6 come from?? I can not understand...

In the end, my goal is to import django with 1.9.2 version in my virtualenv , is there anyway to do this?

Django 1.6.6 is the system default, so it's what you'll see if you're not using your virtualenv. If you use the path to the Python interpreter in your virtualenv as per this example then you'll get the version from your virtualenv.