且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Django模型字段名称"check"引发SystemCheckError

更新时间:2023-02-19 08:02:31

我在Django文档(

I found System check framework in django docs (https://docs.djangoproject.com/en/2.2/ref/checks/#system-check-framework)

在django的系统检查期间调用的检查字段会引发SystemCheckError.

Your check field called during django's system checks so raised SystemCheckError.

它发生在Django的 Basecommand ( https://github.com/django/django/blob/1e87c9fe71703fab23039aa63fafe4f6aac98bbc/django/core/management/base.py#L148 )

It occurred in django's Basecommand (https://github.com/django/django/blob/1e87c9fe71703fab23039aa63fafe4f6aac98bbc/django/core/management/base.py#L148)

1. ``django-admin`` or ``manage.py`` loads the command class
   and calls its ``run_from_argv()`` method.
2. The ``run_from_argv()`` method calls ``create_parser()`` to get
   an ``ArgumentParser`` for the arguments, parses them, performs
   any environment changes requested by options like
   ``pythonpath``, and then calls the ``execute()`` method,
   passing the parsed arguments.
3. The ``execute()`` method attempts to carry out the command by
   calling the ``handle()`` method with the parsed arguments; any
   output produced by ``handle()`` will be printed to standard
   output and, if the command is intended to produce a block of
   SQL statements, will be wrapped in ``BEGIN`` and ``COMMIT``.
4. If ``handle()`` or ``execute()`` raised any exception (e.g.
   ``CommandError``), ``run_from_argv()`` will  instead print an error
   message to ``stderr``.