[Django]-Django django-extensions commands unavailable ( graph_models )

51👍

Run this in manage.py shell:

from django.conf import settings; 'django_extensions' in settings.INSTALLED_APPS

If it doesn’t return True, then it means that you didn’t add ‘django_extensions’ properly in INSTALLED_APPS, and that would be the only reason why Django doesn’t find the command.

👤jpic

6👍

Actually, if you look at your manage.py’s code, you will notice that it sets DJANGO_SETTINGS_MODULES according to your current site: let say “mysite.settings”.
If you want your manage.py to list additional extensions (e.g. ones from django-extensions or django-evolution) then you must add your project-root’s folder to your python path, if not you will only get the bascc manage.py commands.

👤barraq

3👍

I had it under everything else in settings.py INSTALLED_APPS. Moving it at the top fixed it:

From

INSTALLED_APPS = [
    ...
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_extensions',
]

TO

INSTALLED_APPS = [
    'django_extensions',
    ...
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

Leave a comment