Search code examples
pythondjangodjango-1.8

Django management comments not loaded, while settings.INSTALLED_APPS are configured


EDIT: management commands. Not comments. Auto correct..

I was using django 1.7.final.0 for a while, but am now trying to upgrade to 1.8 (..and eventually to the newest version).

When running manage.py help, the commands I see are only the base commands.

I've added a print statement, to see if INSTALLED_APPS works and it does.

import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
    from config import settings
    print(settings.INSTALLED_APPS) # prints apps like django-extensions that have commands.
    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)

There are no errors, but it simply doesn't list the other commands. If I try to run a command, like ./manage.py shell_plus it returns Unknown Command as can be seen below. Note the print statement, indicating that INSTALLED_APPS can be read.

(venv) rootadmin@annotatie01:/data_nfs/opensurfaces2/server$ python manage.py shell_plus
('admin_tools', 'admin_tools.theming', 'admin_tools.menu', 'admin_tools.dashboard', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.humanize', 'gunicorn', 'storages', 'queued_storage', 'django_extensions', 'account', 'django_forms_bootstrap', 'imagekit', 'compressor', 'endless_pagination', 'cacheback', 'captcha', 'mptt', 'debug_toolbar', 'cache_panel', 'memcache_status', 'common', 'home', 'accounts', 'analytics', 'licenses', 'poly', 'mturk', 'categories', 'photos', 'shapes', 'bsdfs', 'normals', 'intrinsic', 'points', 'boxes', 'matclass', 'paintings', 'binaryQuestion')
Unknown command: 'shell_plus'
Type 'manage.py help' for usage.
(venv) rootadmin@annotatie01:/data

Solution

  • The problem was in a dependencies. As this answer says MPTT was in need of an update.

    I upgraded using the below, and now it works.

    python -m pip install 'django-mptt==0.7'