29

I am completely new to python as well as to Django. I got a sample Django Rest project. When I run:

python manage.py makemigrations

I get the error:

ImportError: No module named django_extensions

How can I solve this?

I am running it in a virtualenv

Alasdair
  • 298,606
  • 55
  • 578
  • 516
Hari Krishnan
  • 5,992
  • 9
  • 37
  • 55
  • 2
    are you running your project by `/path/to/your/virtual-environment/bin/python manage.py makemigrations` or just `python manage.py makemigrations`? – Haifeng Zhang May 31 '17 at 16:11
  • 1
    agree with @hari , check if your virtual env is activated or not , because if django is installed then this error should not occured . – tom May 31 '17 at 16:30

1 Answers1

51

It looks as if your sample project relies on django-extensions. You can install it by activating your virtualenv, then running:

pip install django-extensions

Once you have installed django-extensions, you may get a different import error if there are other packages missing from your virtualenv. Hopefully, your sample project will have a requirements.txt file which lists the requirements. If so, you can install the required packages with:

pip install -r requirements.txt
Alasdair
  • 298,606
  • 55
  • 578
  • 516
  • and when i install djangorestframework_swagger, it shows an error "Could not find a version that satisfies the requirement djangorestframework_swagger (from versions: ) No matching distribution found for djangorestframework_swagger ". can u help me on this? – Hari Krishnan May 31 '17 at 16:40
  • If the requirements file for the sample project contains `djangorestframework_swagger`, and it won't install, then you might want to open a bug report. If you search `djangorestframework_swagger` the closest match appears to be `django-rest-swagger`, so you could try `pip install django-rest-swagger`. – Alasdair May 31 '17 at 16:44
  • thanks again. But still i got some issues on this project. Can u plz help on this? When i run makemigrations, error is "No module named models" on line "from gcm.models import get_device_model" – Hari Krishnan May 31 '17 at 16:59
  • No, I can't help with that, because it sounds like a different problem to the original question. – Alasdair May 31 '17 at 17:07