Python Forum

Full Version: ImportError: No module named django.core.exceptions in google app engine
You're currently viewing a stripped down version of our content. View the full version with proper formatting. module was missing from google.appengine.ext.db. So I manually putted the module there from net. But it can't import django.core.exceptions. I've two version of python installed in my windows 10 and have added python 2.7 on the path. IDLE 2.7 successfully runs [pyhton]import django[/python] . Below is the log console message of google app engine. Have googled numerous times but couldn't find any fruitful solution. Any help?[I'm a newbie who is learning from head first python(1st edition)]

ERROR 2018-06-18 09:47:26,513] Traceback (most recent call last): File "F:\Coding Practise\head_first_series\python\ch10_tariq\hfwwgapp\", line 5, in <module> from google.appengine.ext.db import djangoforms File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\db\", line 98, in <module> import django.core.exceptions ImportError: No module named django.core.exceptions
did you ever install django?
Are you in a virtual environment?
django.core.exceptions is part of the django package.
to install, you must be running a shell in the virtual environment, then call:
pip install django
I've installed django.
running "import django" does not give me any error message in idle.
C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\django is present with .....doesn't it mean that django is already installed in app engine?! ...but import django shows an import error.
Usually Django is run from a virtual environment. If your django project is being run from a virtual environment, it has to be installed in the virtual environment as well.

If you are going to be using Django, use an IDE that is virtual environment friendly, such as VS Code. It will save you a lot of grief in exchange for a few hours of learning pain.

a Virtual Environment is isolated from other software on your system. This is what makes it so useful. When you are done with your code, you can create a master package that won't have the overhead of unneeded and unused packages.

Your code will have it's own copy of python, Django (but you have to install it while in virtual environment), and any other needed package.