首页 > 代码库 > python加载django环境

python加载django环境

import osimport sysROOT = ‘settings.py所在目录‘sys.path.append(ROOT)from django.core.management import setup_environimport settingssetup_environ(settings)