1

I am using LiClipse on OSX and trying to run django application using the Eclipse run configuration (this manages the virtualenv?). The app is not of my creation but works in production so I assume it is my environment that needs corrected. The app is structured as:

PyDev Project Folder
--manage.py
--requirements.txt
--django-app-folder
-----config-folder
--------__ini__.py
--------settings.py
--------evniroments.py
--------urls.py
--------wsgi.py
-----app-folder
--------__ini__.py
--------lots of other stuff

When I try to run the application it fails to import a module: enter image description here

This appears to be fairly common, at least there a several other questions that are comparable and many dated ones such as: Eclipse + PyDev ImportError and ImportError: cannot import name... but they do not answer the question of how to configure the Eclipse run correctly for PyDev?

I have followed the docs at PyDev and the guidance in the referenced SO links such as removing the interpreter settings from PyDev and then adding it back and "Check if interpreters are synchronized with environment".

Here is the PYTHONPATH for the run config I am using: enter image description here

And the interpreter settings under PyDev preferences - I have tried both the egg and the folder as well as each on their own: enter image description here

Community
  • 1
  • 1
Tom
  • 981
  • 11
  • 24
  • Have you added `'django_filters'` to your `INSTALLED_APPS`? – rnevius Jun 10 '15 at 15:34
  • Yes, the settings.py has INSTALLED_APPS and 'django_filters' is included. The app is not of my creation but works in production so I assume it is my environment that needs corrected. – Tom Jun 10 '15 at 16:21
  • Same issue: no module named PyQt5. site-packages and PyQt5 dir are on sys.path (PYTHONPATH). Means I can't use PyDev, which sucks, because Eric IDE sucks, PyCharm can't debug PyQt5 apps without who knows what, and my subscription to Wing is over (Wing was the best IDE for PyQt5 app dev). – MathCrackExchange Dec 30 '16 at 22:16

2 Answers2

2

I had a similar problem with eclipse on linux. I solved it defining the 'Django settings module' in the 'PyDev - Django' chapter of the project properties.

In your case it should be 'django-app-folder.config-folder.settings'.

Hope it helps.

0

There something strange in your PYTHONPATH: you have a django_filters_xxx.egg entry and a django_filters_xxx.egg/filters entry, which seems odd... is the .egg a folder or a zip in your case?

Does it work in the command line? If it works in the command line, you can try adding:

import sys
print('\n'.join(sorted(sys.path)))

on the command line and comparing with the one in PyDev to check if there's something wrong there.

Another common issue is that sometimes you are shadowing the import with a module with the same name in your project.

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78