python 将PyCharm社区Python控制台更改为PyCharm Professional Django控制台(Django Shell)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 将PyCharm社区Python控制台更改为PyCharm Professional Django控制台(Django Shell)相关的知识,希望对你有一定的参考价值。
# Change the run script on `settings> Build Execution and Deployment > Console > Python Console` to
# hoping you have your settings at project/project/settings.py (if not, change accordingly;)
import os,sys,django;sys.path.extend([WORKING_DIR_AND_PYTHON_PATHS])
os.environ['DJANGO_SETTINGS_MODULE'] = WORKING_DIR_AND_PYTHON_PATHS.split('/')[-1]+'.settings'
print('Python {0} on {1} using {2} as settings'.format(sys.version, sys.platform, os.environ['DJANGO_SETTINGS_MODULE']))
django.setup()
以上是关于python 将PyCharm社区Python控制台更改为PyCharm Professional Django控制台(Django Shell)的主要内容,如果未能解决你的问题,请参考以下文章