##在脚本的头加:app
sys.path.append('/home/XXXX') #manage.py的目录 os.environ['DJANGO_SETTINGS_MODULE'] = 'AAA.settings' #setting的目录脚本