import sys, django
print('Python %s on %s' % (sys.version, sys.platform))
print('Django %s' % django.get_version())
sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])
if 'setup' in dir(django):
django.setup()
from django_extensions.management.debug_cursor import monkey_patch_cursordebugwrapper
monkey_patch_cursordebugwrapper(print_sql=True, confprefix='SHELL_PLUS').__enter__()
from django_extensions.management.commands.shell_plus import Command
from django.core.management.color import color_style
globals().update(Command().get_imported_objects({}))
shell_plus - django-extensions 3.2.1 documentation
SHELL_PLUS_PRINT_SQL =True
# To disable truncation of sql queries use
SHELL_PLUS_PRINT_SQL_TRUNCATE = None
Run shell_plus through PyCharm?
Run manage.py shell_plus --print-sql in Pycharm Django Console