django import error – No module named core.management

If, like me, you are running your django in a virtualenv, and getting this error, look at your manage.py.
The first line should define the python executable used to run the script.
This should be the path to your virtualenv’s python, but it is something wrong like /usr/bin/python, which is not the same path and will use the global python environment (and packages will be missing).
Just change the path into the path to the python executable in your virtualenv.

You can also replace your shebang line with #!/usr/bin/env python. This should use the proper python environment and interpreter provided that you activate your virtualenv first (I assume you know how to do this).

Leave a Comment