今天下载并观看pylons的视频教程
http://media.knowledgetap.com/tesla.flv
然后又去按照<<Making a Pylons Blog >>这个教程敲了一点代码
http://wiki.pylonshq.com/display/pylonscookbook/Making+a+Pylons+Blog
收获如下:
1.
@classmethod
可以定义一个类和实例都可以调用方法,参数是类的类型
2.
from randon import sample
sample(xrange(10000),20)
在指定范围中取样
3.
development.ini
配置如数据库地址等等的常量
项目目录下
config/environment.py
启动时初始化pylons的环境,它会读取development.ini到config变量中
model/__ init __.py
定义数据库的表和ORM
websetup.py
建立数据,表结构等等(用命令paster setup-app development.ini执行)
搞定数据库,接下来可以写模板和controller了,明天继续
#model/__ init __.py
metadata = sa.MetaData()
def Table(name,*args,**keys):
return sa.Table(
name,metadata,
sa.Column("id", types.Integer, primary_key=True,autoincrement=True),
*args,**keys
)
def ForeignKey(tabel,*args,**keys):
tabel_name=tabel.name
return sa.Column(
'%s_id'%tabel_name,
types.Integer,
sa.ForeignKey('%s.id'%tabel_name),
*args,
**keys
)
resource_site_table=Table(
"resource_site",
sa.Column("href", types.String()),
sa.Column("title", types.String(255)),
sa.Column("brief", types.String()),
sa.Column("update_time", types.DateTime()),
)
subject_table=Table(
"subject",
ForeignKey(resource_site_table),
sa.Column("href", types.String()),
sa.Column("title", types.String(255)),
sa.Column("update_time", types.DateTime()),
)
plunder_table =Table(
"plunder",
ForeignKey(subject_table),
sa.Column("href", types.String()),
sa.Column("title", types.String(255)),
sa.Column("brief", types.String()),
sa.Column("update_time", types.DateTime(),default=lambda:datetime.now()),
sa.Column("tag", types.String(255)),
sa.Column("author", types.String(255)),
sa.Column("content", types.String()),
)
class ResourceSite(object):
def __str(self):
return self.title
class Subject(object):
def __str(self):
return self.title
class Plunder(object):
def __str(self):
return self.title
分享到:
- 2008-01-01 22:12
- 浏览 2288
- 评论(0)
- 论坛回复 / 浏览 (0 / 2568)
- 查看更多
相关推荐
可用于UnityVR开发,3D游戏开发,高清天空盒子Skybox素材,游戏环境背景素材...2-创建空Material,并转换成Cube/skybox形式, 3-将图片拖入新建的SkyboxMaterial, 4-用刚创建的Material代替项目中原本的系统默认Skybox
In this book, cofounder and lead developer James Gardner brings you a comprehensive introduction to Pylons, the web framework that uses the best of Ruby, Python, and Perl and the emerging WSGI ...
The Definitive Guide to Pylons.pdf
主要介绍了Python Web框架Pylons中使用MongoDB 的例子,大家参考使用
python库,解压后可用。 资源全名:Pylons-0.8.2-py2.3.egg
资源来自pypi官网。 资源全名:Pylons-0.8.2-py2.3.egg
Apress.the.Definitive.Guide.to.Pylons.Dec.2008
塔架 Pylons是一个快速的Web应用程序开发框架。 笔记定向塔已与repoze.bfg合并,并且现在处于仅维护模式。 强烈建议新项目从新的合并的Web框架。安装。 如果要从源代码安装,可以运行以下命令: $ python setup.py ...
pyramid是最新python web开发框架,pylons升级版。
Web Server:JCR使用Pylons内建的Web server,不需要其他Server。 依赖的软件: Python 2.4 or later (2.5+ recommended) Pysqlite(DB-API 2.0 interface for SQLite databases) Setuptools Pysvn 注意:下载...
博文链接:https://zsp.iteye.com/blog/178446
pyramid_debugtoolbar pyramid_debugtoolbar提供了一个调试工具栏,在您开发Pyramid应用程序时非常有用。 请注意, pyramid_debugtoolbar是Michael van ... $ git clone https://github.com/Pylons/pyramid_debugtool
Django,Pylons等几个方面,最后一章也就是第九章,介绍了一些具体例子,也需要 数据库、网页等方面配合。都是俺暂时用不到的。 前几个章节适合大多数Python Coder使用俺就不剧透了。 此书具有Packt 出版书的一般...
pyramid1.2源码安装包。pyramid是最新python web 开发框架。是pylons的升级版。
(2)the cable system supporting the deck; (3)the pylons (or towers) supporting the cable system; (4)the anchor blocks (or anchor piers) supporting the cable system vertically and horizontally, or only ...
zope, pyramid, pylons框架常用模版系统 chameleon zpt的程序员指南
相比而言,Django 内建的模板引擎,为了维持所谓模板语法的纯粹性和简单性,更纯粹的满足 MVC 模式的规定,牺牲了很多灵活性,一些高级的功能不得不利用 tag 和 filter 来实现,其写法并不太方便。因此,将 Mako ...