Martin Slater
Martin Slater

Reputation: 53

Why do I get the error "ModuleNotFoundError: No module named 'django-extensions'" when running startapp

I am learning Django through the dj4e course. In my project I have set up django-extensions for a previous section of the course. When I moved to a new section and created a new app with the code

python manage.py startapp autos

I get the error

"ModuleNotFoundError: No module named 'django-extensions'"

I have resolved this by commenting out 'django-extensions' in the settings.py file.

However can anyone talk me through why this happened, I'm trying to get a better understanding of the processes.

edit I am working in a virtual environment and django-extensions is installed in that environment.

Upvotes: 4

Views: 3488

Answers (2)

kutaev
kutaev

Reputation: 1

You need to do migration after 'django_extensions' was installed:

python manage.py migrate

Even if you get the message "No migrations to apply.", next time an error "ModuleNotFoundError: No module named 'django-extensions'" will not appear.

Upvotes: 0

Aswin A
Aswin A

Reputation: 99

You can check whether django-extensions is installed in your virtual environment by entering below code in your shell

import django_extensions
django_extensions.VERSION

if you are getting ModuleNotFoundError then install django-extensions using pip install django-extensions

After successfull installation add django_extensions to your settings.py file as below.

INSTALLED_APPS = (
    ...
    'django_extensions',
)

Upvotes: 1

Related Questions