Fixing django-admin error on osx

It’s been some time since I’ve used django. Yesterday I wanted to create a new project.

So, I entered django-admin.py start-project myProject in a terminal window and got the following error message:

Traceback (most recent call last):
     File "/usr/local/bin/django-admin.py", line 2, in 
      from django.core import management
      ImportError: No module named django.core

I googled a lot and found a short and simple workaround.

Both (django-admin.py and python) is located at /usr/local/bin. Take a look at the top of django-admin.py. There you can find a line like: #!/usr/bin/python. Change this to #!/usr/local/bin/python and everything works well.

Update: Another option is to create a simlink at /usr/local/bin/python to point to /usr/bin/python.

At the moment I don’t know exactly why there is a path to /usr/bin/python. Maybe if I have some time next week, I’ll take a look.

comments powered by Disqus