ImportError: No module named django_extensions
Asked Answered
C

2

30

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

Condyloid answered 31/5, 2017 at 16:6 Comment(2)
are you running your project by /path/to/your/virtual-environment/bin/python manage.py makemigrations or just python manage.py makemigrations?Oldie
agree with @hari , check if your virtual env is activated or not , because if django is installed then this error should not occured .Dugaid
H
53

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
Hereto answered 31/5, 2017 at 16:33 Comment(4)
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?Condyloid
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.Hereto
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"Condyloid
No, I can't help with that, because it sounds like a different problem to the original question.Hereto
D
1

Install the package using below command:

pip install django-extensions

after installing it in your django project, you have load this extension by inserting it in INSTALLED_APPS defined settings.py file of your project like the following way

INSTALLED_APPS = [ 'django_extensions' ]

Just append 'django_extensions' element in list of INSTALLED_APPS

Thanks :)

Disarray answered 16/12, 2023 at 10:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.