Django2.1遇到 app_label and isn't in an application in INSTALLED_APPS 错误

Django在应用列表中添加新的应用时有时会出错

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    'news_web',
    'DjangoUeditor',
    'mdeditor',
    'django_markdown',
    'markdownx',
    #'fluent_contents',
]

启动项目时报错为

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7efe941f08c8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/core/management/commands/runserver.py", line 111, in inner_run
    autoreload.raise_last_exception()
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/utils/autoreload.py", line 248, in raise_last_exception
    raise _exception[1]
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/core/management/__init__.py", line 329, in execute
    autoreload.check_errors(django.setup)()
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/apps/registry.py", line 120, in populate
    app_config.ready()
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/contrib/admin/apps.py", line 23, in ready
    self.module.autodiscover()
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/contrib/admin/__init__.py", line 26, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/utils/module_loading.py", line 47, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/py/super/news_web/admin.py", line 7, in <module>
    from fluent_contents.admin import PlaceholderFieldAdmin
  File "/usr/local/lib/python3.6/site-packages/fluent_contents/admin/__init__.py", line 14, in <module>
    from fluent_contents.admin.placeholdereditor import PlaceholderEditorAdmin, PlaceholderEditorInline, PlaceholderEditorBaseMixin
  File "/usr/local/lib/python3.6/site-packages/fluent_contents/admin/placeholdereditor.py", line 14, in <module>
    from fluent_contents import extensions
  File "/usr/local/lib/python3.6/site-packages/fluent_contents/extensions/__init__.py", line 12, in <module>
    from .pluginbase import PluginContext, ContentPlugin, HttpRedirectRequest
  File "/usr/local/lib/python3.6/site-packages/fluent_contents/extensions/pluginbase.py", line 13, in <module>
    from django.contrib.sites.models import Site
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/contrib/sites/models.py", line 80, in <module>
    class Site(models.Model):
  File "/usr/local/lib/python3.6/site-packages/Django-2.1-py3.6.egg/django/db/models/base.py", line 99, in __new__
    "INSTALLED_APPS." % (module, name)
RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

将不用的app注释掉也没有起到作用,上网查解决方案。找了半天在Stack Overflow上找找到一篇答案,解决方法如下:
在setting中增加

INSTALLED_APPS = [
    ...
    'django.contrib.sites',
]

SITE_ID = 1

然后在启动项目即恢复正常
stack overflow链接地址

What Isn't in Palm OS Cobalt... Yet

02-14

http://www.brighthand.com/article/Whats_Not_in_CobaltrnrnBy Ed Hardy | Editor-in-ChiefrnFeb 10, 2004rnAt the PalmSource conference today, company executives have been talking about all the new features in Palm OS Cobalt. However, there are some significant features that didn't make it into this version. Still, PalmSource says these will be in a future version rnrnUser Interface (UI)rnThe look and feel of the Palm OS has changed very little since its earliest days. Though many are accustomed to the way the user interface works, one of the most popular categories of Palm applications is Launcher replacements, which shows that there's room for improvement. rnrn However, the UI in Palm OS Cobalt remains almost unchanged from the previous versions (see picture at left). About the only difference is the inclusion of the Task Bar, though several handhelds already use versions of this. rnrnStill, Larry Slotnick from PalmSource said this morning that his company intends to change the look and feel in the next version of Cobalt. He didn't give any details of what the differences will be. Still, the changes made to the new version of the Address Book might be a clue of the direction PalmSource is going. It uses a series of tabs across the top of the screen to show various screens of information. rnrnFile ManagerrnAnother feature of the Palm OS that hasn't changed Is the fact that there is no file management system in RAM. This means that all files in the handheld's memory exist on the same level, and aren't broken up into groups. rnrnIn addition, the Palm OS severely limits the types of files that can be stored in RAM, though developers have found somewhat kludgy work-arounds for this. rnrnPalmSource's Mr. Slotnick said today this is also on his company's agenda for a future version of Cobalt. While he would't say any more, he did say that the developers don't necessarily think that the familiar paradigm of files in folders is appropriate for handhelds. rnrnApple Macintosh SynchronizationrnThe previous features are ones that aren't yet available in the Palm OS, but will be someday. Macintosh synchronization is something that the Palm OS used to offer, but won't any more. rnrn Mr. Slotnick (see picture at right) made it clear that PalmSource isn't developing a Mac version of the Palm Desktop. As the way the PIM apps work has changed significantly, this means Mac users won't be able to HotSync without third-party software. rnrnFortunately, a third party has already stepped forward. Mark/Space is going to release a version of its Missing Sync application for Cobalt. This will allow existing Mac conduits for other third-party applications to still work. rnrnIn addition to the standard functions, Missing Sync for Cobalt will allow Bluetooth and Wi-Fi HotSyncing. rnrnMark/Space indicated this application will probably cost about what the current one does now, about $40. However, the company is open to licensing its application to Palm OS licensees who want to add Mac OS X synchronization to their handhelds.rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试