上一页 1 2 3 4 5 6 7 8 9 10 ··· 48 下一页
摘要: 记录了一下实践过的API都能用,具体估计就我能看懂。看不懂的留言。。# 查看数据库对应所有数据对象 对象名.objects.all()# 读取指定ID的数据(返回对象) 对象名.objects.filter(id=1)# 获取具体数据 对象名.objects.get((id|pk)=1) (如果没有就抛异常)# 一对多关联 p=对象.objects.get(id=1) p.被关联_set.all()# 增加数据 c=p.被关联_set.create(choice_text=内容,votes=0)# 查看被关联的对象 c.对象# 查看所有一对多的值 p.被关联_set.all(... 阅读全文
posted @ 2013-12-30 14:01 墨迹哥's 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 特别2的情况,奶奶的输出提示有错误把我整蒙了。。每当创建一个Model以后需要更新。具体提示如下:root@smart:~/mysite# python manage.py syncdbOperations to perform: Synchronize unmigrated apps: admin, contenttypes, auth, sessions Apply all migrations: (none)Synchronizing apps without migrations: Creating tables... Installing custom SQL... Ins... 阅读全文
posted @ 2013-12-30 11:09 墨迹哥's 阅读(467) 评论(0) 推荐(0) 编辑
摘要: 创建应用.按照实例敲,但是失败了。。所以复制粘帖看看结果啥样,再对比下。研究哪错了。正常结果输出:root@smart:~/web_scan_django# python manage.py sql pollsBEGIN;CREATE TABLE `polls_poll` ( `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY, `question` varchar(200) NOT NULL, `pub_date` datetime NOT NULL);CREATE TABLE `polls_choice` ( `id` ... 阅读全文
posted @ 2013-12-30 10:36 墨迹哥's 阅读(329) 评论(0) 推荐(0) 编辑
摘要: 有个需求,目前准备用python来实现,所以有了这么个东西。在国内貌似Django还是挺适合python Web开发的。所以选择它 -Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 170, in wrapper fn(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/core/management/ 阅读全文
posted @ 2013-12-30 10:19 墨迹哥's 阅读(4204) 评论(0) 推荐(0) 编辑
摘要: 依赖Mysql数据库!#!/usr/bin/python# vim: set fileencoding=utf-8:import sysimport urllib2import refrom BeautifulSoup import BeautifulSoupimport ConfigParserimport MySQLdb as mdbclass Db_Connector: def __init__(self, config_file_path): cf = ConfigParser.ConfigParser() cf.read(config_file_pa... 阅读全文
posted @ 2013-12-24 14:32 墨迹哥's 阅读(1882) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 48 下一页