Last active
January 20, 2024 15:50
-
-
Save DoonDoony/3fd7689bbbc40e3b779f36b765052f27 to your computer and use it in GitHub Desktop.
Using `shell_plus` in pycharm django console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 💡 NOTE: This only works if you are pretend to using `Django Console` feature in Pycharm | |
# Paste codes below into `Build, Execution, Deployment > Console > Django Console > Starting Script` | |
# requirements: `django_extensions`, `IPython` | |
import sys | |
import django | |
from IPython.core.getipython import get_ipython | |
from django_extensions.management.notebook_extension import load_ipython_extension | |
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() | |
ipython = get_ipython() | |
load_ipython_extension(ipython) | |
# NOTE: If you don't use the autoreload feature, don't paste the three lines below | |
load_ipython_extension(ipython) | |
ipython.extension_manager.load_extension('autoreload') | |
ipython.magics_manager.registry['AutoreloadMagics'].autoreload('2') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
many thx!