Chinaunix首页 | 论坛 | 博客
  • 博客访问: 483911
  • 博文数量: 71
  • 博客积分: 1332
  • 博客等级: 少尉
  • 技术积分: 772
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-10 16:25
个人简介

文章分类

全部博文(71)

文章存档

2013年(19)

2012年(9)

2011年(43)

分类: 系统运维

2013-06-04 13:59:43

参考:
http://blog.csdn.net/xsmile2012/article/details/6714304
http://dtr1988.iteye.com/blog/1338596




写了个python脚本,想通过 django的app中的models.py 访问mysql
遇到了各种不能import 的error

通过上面的2个连接的内容介绍,解决了


在代码中添加:
from django.conf import settings 
settings.configure() 

脚本中增加:
#!/bin/env python
import sys
sys.path.append('/home/Naruto/naruto/naruto')
#from django.conf import settings
#settings.configure()
from netlink.models import *   # 原来import的时候总是报错

现在记录下来,得个教训


阅读(1600) | 评论(0) | 转发(0) |
0

上一篇:awk

下一篇:dell em1 eth0

给主人留下些什么吧!~~