|-- dbquery
| |-- __init__.py
| |-- models.py
| |-- tests.py
| `-- views.py
|-- __init__.py
|-- manage.py
|-- settings.py
|-- standalone.py
`-- urls.py
standalone.py是我写的,其它都是按django教程生成的
#!/usr/bin/env python
#encoding=utf-8
from django.core.management import setup_environ
import sys
sys.path.append("/home/mlzboy/django_test") # django项目所在的目录
import settings
setup_environ(settings)
from dbquery.models import Dbquery # 导入Model
a = Dbquery.objects.all()
print a