简体   繁体   中英

shell_plus isn't autoloading all the apps it should be

Below I'm showing what happens when I run ./manage.py shell_pus and what my settings.py file looks like.

jason@buster:~/projects/mcifdjango$ ./manage.py shell_plus
From 'auth' autoload: Permission, Group, User, Message
From 'contenttypes' autoload: ContentType
From 'sessions' autoload: Session
From 'sites' autoload: Site
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
jason@buster:~/projects/mcifdjango$ tail -c387 settings.py

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django_extensions',
    'mcif',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)

Here are the relevant parts, isolated. Here's what it's loading:

From 'auth' autoload: Permission, Group, User, Message
From 'contenttypes' autoload: ContentType
From 'sessions' autoload: Session
From 'sites' autoload: Site

And here's what I believe it should be loading:

    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django_extensions',
    'mcif',

As you can see, 'django.contrib.messages' , 'django_extensions' and 'mcif' are being left behind. I have no idea what's causing this or how to troubleshoot it. Any advice?

Django_extensions has no models to load, so it's not strange that no model is loaded.

OTOS the Messages model that is being loaded in the 'auth' line is probably the one from contrib.messages. Explore the model class in the shell to verify its app_label.

For what matters your custom 'mcif' app, it probably has no models, or they are incorrectly declared. Anyway a code example could help isolate the problem, if any.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM