简体   繁体   English

shell_plus不会自动加载应有的所有应用程序

[英]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. 下面显示的是我运行./manage.py shell_pus时发生的情况以及settings.py文件的外观。

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. 如您所见, 'django.contrib.messages''django_extensions''mcif'被遗忘了。 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. Django_extensions没有要加载的模型,因此不加载任何模型并不奇怪。

OTOS the Messages model that is being loaded in the 'auth' line is probably the one from contrib.messages. OTOS在'auth'行中加载的Messages模型可能是contrib.messages中的模型。 Explore the model class in the shell to verify its app_label. 在外壳中浏览模型类以验证其app_label。

For what matters your custom 'mcif' app, it probably has no models, or they are incorrectly declared. 对于您的自定义“ mcif”应用而言,很重要的一点是,它可能没有模型,或者它们的声明不正确。 Anyway a code example could help isolate the problem, if any. 无论如何,代码示例可以帮助隔离问题(如果有)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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