import os
import sys
ROOT = 'settings.py所在目录'
sys.path.append(ROOT)
from django.core.management import setup_environ
import settings
setup_environ(settings)
import os
import sys
ROOT = 'settings.py所在目录'
sys.path.append(ROOT)
from django.core.management import setup_environ
import settings
setup_environ(settings)
转载于:https://www.cnblogs.com/auio/p/3858066.html