Django manage.py can't find an INSTALLED_APP even though the module is in the path
When I run python manage.py shell I get an error about the last app I've added to INSTALLED_APPS, namely django-evolution, saying it's an undefined module. This is despite the fact that I've added the path to django-evolution to the system path. In fact right after this error I can run python and do an import on django_evolution and everything is fine. Why isn't django or python seeing t开发者_运维知识库his module when clearly it's been setup and even added to the path?
EDIT:
This only happens when running from iPython. When I run from the cmd prompt it works fine. Go figure.
Does your django_evolution
have a init.py file in it? Also any folder containing django_evolution
needs one.
You need to add it to your INSTALLED_APPS section of settings.py.
If you are using virtualenv and ipython is installed at the system level but your app at the env level, it will lead to this. The way out of it is to remove ipython from the system and to install it into your env.
I know this is super old, but in case anyone has this issue, my issue was because I had elevated to root inside my venv. I had initialized my virtual environment, and then upgraded my privileges to root. If deactivate
doesn't work and you're root, then you should exit
then deactivate
, then you can do sudo su
and then source myenv/bin/activate
. Hope this helps!
精彩评论