Wednesday, December 04, 2013

Pydev defect with Django 1.6?

In Pydev 3.0 Django menu, you can start the shell with current project path included. However, when using this functionality with Django 1.6 project, the following error will be thrown:
from django.core import management;import tutorial.settings as settings;management.setup_environ(settings) Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'setup_environ'
It turned out that module setup_environ was removed from django.core.management in v1.6 while pydev still calls this module.
In order to fix the issue, you just need to run the following statement:
os.environ['DJANGO_SETTINGS_MODULE'] = '(project).settings'
Please replace (project) with your django project name.