Django是否在此错误消息中抱怨自己?

时间:2015-09-14 19:46:46

标签: django

当我启动服务器时,我得到:

/usr/lib64/python2.7/site-packages/django/contrib/admin/util.py:7: RemovedInDjango19Warning: The django.contrib.admin.util module has been renamed. Use django.contrib.admin.utils instead.
  "Use django.contrib.admin.utils instead.", RemovedInDjango19Warning)

/usr/lib64/python2.7/site-packages/django/contrib/contenttypes/models.py:159: RemovedInDjango19Warning: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.
  class ContentType(models.Model):

/usr/lib64/python2.7/site-packages/django/contrib/admin/util.py:7: RemovedInDjango19Warning: The django.contrib.admin.util module has been renamed. Use django.contrib.admin.utils instead.
  "Use django.contrib.admin.utils instead.", RemovedInDjango19Warning)

/usr/lib64/python2.7/site-packages/django/contrib/contenttypes/models.py:159: RemovedInDjango19Warning: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9.
  class ContentType(models.Model):

Performing system checks...

System check identified no issues (0 silenced).
September 14, 2015 - 19:45:18
Django version 1.8.4, using settings 'viewer.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

这四个RemovedInDjango19Warning是否应该忽略?我为所提到的问题编写了我的代码,我在代码中找不到它们。

1 个答案:

答案 0 :(得分:1)

对于内容类型警告,请确保acc = [] for path in paths: print 'A path: ', path acc.append(mkPool(path)) print 'Accuracy: ', acc[-1] 设置中有contenttypes。这是必需的,因为项目中的某些代码(例如django-mass-edit)使用INSTALLED_APPS模型。

ContentType

另一个INSTALLED_APPS = ( ... 'django.contrib.contenttypes', ... ) 警告已在django-mass-edit issue 47中修复,但在撰写本文时尚未发布新版本。因为它只是一个弃用警告,所以在实际升级到Django 1.9之前不需要担心它。