About Django Console in PyCharm with Multiple Django Settings
When you have multiple Django settings (for example, for a multi-site project), Django shell in PyCharm doesn't allow you to select the settings and just uses the default project settings.
But you can fix that. Go to:
Preferences... ➔ Build, Execution, Deployment ➔ Console ➔ Django Console
Then change the content of Starting script:
import sys; print('Python %s on %s' % (sys.version, sys.platform))
import django; print('Django %s' % django.get_version())
sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])
settings_path = input("Enter project settings path")
import os; os.environ["DJANGO_SETTINGS_MODULE"] = settings_path
if 'setup' in dir(django): django.setup()
import django_manage_shell; django_manage_shell.run(PROJECT_ROOT)
Tips and Tricks Programming Developer Experience Django 4.2 Django 3.2 Django 2.2 Python 3 PyCharm
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django GDPR Cookie Consent app
For Django websites that use cookies.