PyDev's inteactive shell with Django problem -
i'm going through django tutorial , using pydev eclipse plugin development.
for interactive testing use "interactive shell django" accessed right click on pydev project -> django -> shell django environment.
and here problem encountered ("lemonanas" project name, "polls" app name):
>>from lemonanas.polls.models import poll, choice >>poll.objects.filter(id=1) traceback (most recent call last): file "<console>", line 1, in <module> file "f:\python27\lib\site-packages\django\db\models\manager.py", line 141, in filter return self.get_query_set().filter(*args, **kwargs) file "f:\python27\lib\site-packages\django\db\models\query.py", line 561, in filter return self._filter_or_exclude(false, *args, **kwargs) file "f:\python27\lib\site-packages\django\db\models\query.py", line 579, in _filter_or_exclude clone.query.add_q(q(*args, **kwargs)) file "f:\python27\lib\site-packages\django\db\models\sql\query.py", line 1170, in add_q can_reuse=used_aliases, force_having=force_having) file "f:\python27\lib\site-packages\django\db\models\sql\query.py", line 1058, in add_filter negate=negate, process_extras=process_extras) file "f:\python27\lib\site-packages\django\db\models\sql\query.py", line 1225, in setup_joins field, model, direct, m2m = opts.get_field_by_name(name) file "f:\python27\lib\site-packages\django\db\models\options.py", line 296, in get_field_by_name cache = self.init_name_map() file "f:\python27\lib\site-packages\django\db\models\options.py", line 326, in init_name_map f, model in self.get_all_related_m2m_objects_with_model(): file "f:\python27\lib\site-packages\django\db\models\options.py", line 401, in get_all_related_m2m_objects_with_model cache = self._fill_related_many_to_many_cache() file "f:\python27\lib\site-packages\django\db\models\options.py", line 415, in _fill_related_many_to_many_cache klass in get_models(): file "f:\python27\lib\site-packages\django\db\models\loading.py", line 167, in get_models self._populate() file "f:\python27\lib\site-packages\django\db\models\loading.py", line 61, in _populate self.load_app(app_name, true) file "f:\python27\lib\site-packages\django\db\models\loading.py", line 76, in load_app app_module = import_module(app_name) file "f:\python27\lib\site-packages\django\utils\importlib.py", line 35, in import_module __import__(name) importerror: no module named polls
if use default shell, executing "manage.py shell" - works fine. default shell not such comfortable "interactive shell django".
i noticed "interactive shell django" not add app folder (polls) python path. , guess essense of problem. don't know how entirely solve "import/pythonpath/etc." problems "interactive shell django". hope can me. thanks.
customize python path, eclipse uses include path project. (not each app, project folder. - 1 contains settings.py)
Comments
Post a Comment