[Solved-5 Solutions] Django import error No module named core management
Error Description:
Django import error No module named core management
Solution 1:
We are started working through the Django 1.1.1 and promptly ran into the following error:
we was trying to execute the following command from the mysite project directory:
- We are using python 2.5 on Mac OS X, 10.6.2 (Snow Leopard) because we learning Django to use in conjunction with Google App Engine.
- The first change we made was to set an alias so that python 2.5 is used. The second was to move /Library/Python/2.5/site-packages to the beginning of PYTHONPATH. we made these changes by adding two lines to .profile:
Solution 2:
- If, like us, we are running our django in a virtualenv, and getting this error, look at our manage.py. The first line should define the python executable used to run the script.
- This should be the path to our 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 our virtualenv.
- We can also replace our shebang line with #!/usr/bin/env python. This should use the proper python environment and interpreter provided that we activate our virtualenv first.
Solution 3:
If we are in a virtualenv we need to activate it before we can run ./manage.py 'command'
if weconfigworkon in .bash_profile or .bashrc
Solution 4:
We should not do sudo pip install Django
Instead, install it this way:
Solution 5:
Our setup/scenario:
- Windows, Python27
- Our django project is checked out via svn
- when running python manage.py runserver in the new folder, we got the import error
- python manage.py runserver used to work in the original folder (which we would commit changes from) until we deleted it
Remove any the folder named django in the same directory of manage.py
As soon as we removed the folder "django" which only contained a initt.py file.we could run the server again.