我正在尝试在 Django 中排除某些表来执行检查命令我发现了这个问题:How do I inspectdb 1 table from database which contains 1000 tables similar to mine 但问题是当我运行相同的代码时我得到一个奇怪的错误 script.py
from django.core.management.commands.inspectdb import Command
from django.conf import settings
from SFP_test.settings import DATABASES
if not settings.configured:
settings.configure()
settings.DATABASES = DATABASES
Command().execute(table_name_filter=lambda table_name: table_name in ('base_table', 'bp_table', ), database='sfp')
错误:
Traceback (most recent call last):
File "/Users/user/PycharmProjects/SFP_crud_test/generateapp.py", line 24, in <module>
Command().execute(table_name_filter=lambda table_name: table_name in ('base_table', 'bp_table', ), database='sfp')
File "/Users/user/PycharmProjects/SFP_test/venv/lib/python3.7/site-packages/django/core/management/base.py", line 348, in execute
if options['force_color'] and options['no_color']:
KeyError: 'force_color'