I'm trying to execute inspected command with the exclusion of some tables in Django I've found this question: How do I inspectdb 1 table from database which Contains 1000 tables similar to mine but the problem is when I run the same code i get a strange error 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')
error:
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'
Try the following
output.pywill have your table ModelAdditionally, ensure to have your database configured in
settings.pyas following