import site
site.addsitedir("path to your project") //导入project
import sys,os
sys.path.insert(0,"path to the parent folder of your project")
os.environ['DJANGO_SETTINGS_MODULE']='project.settings' # 导入设置,其实也是设置 DJANGO_SETTINGS_MODULE环境变量
from django.db import models
site.addsitedir("path to your project") //导入project
import sys,os
sys.path.insert(0,"path to the parent folder of your project")
os.environ['DJANGO_SETTINGS_MODULE']='project.settings' # 导入设置,其实也是设置 DJANGO_SETTINGS_MODULE环境变量
from django.db import models
from app.models import * //导入app的models
参考http://my.oschina.net/renwofei423/blog/13821,
内容不够完善,还待以后补全