TurboGears2的最小可插拔照片库,基于EasyCrudRestController的管理
tgapp-photos的Python项目详细描述
关于TGApp照片
photos是TurboGears2的可插入照片应用程序。 它作为一个如何使用tgext.crud.easycrudrestcontroller的例子诞生了 在可插入的应用程序中,但可以用于快速实现 任何涡轮齿轮应用内的图片库。
安装
tgapp照片既可以从pypi安装,也可以从bitbucket安装:
easy_install tgapp-photos
应该只对大多数用户有效
插入照片
在应用程序中config/app_cfg.py导入plug:
from tgext.pluggable import plug
然后在文件的结尾处用照片呼叫插头:
plug(base_config, 'photos')
您可以访问照片处理 http://localhost:8080/photos。
暴露部分
照片暴露了一堆可以使用的部分 渲染照片库中的任何位置 应用程序:
- photos.partials:gallery -> Renders a photo gallery, if none specified renders the first available
- photos.partials:albums -> Renders preview of galleries, if none specified renders all the galleries
公开模板
照片使用的模板,可替换为 tgext.pluggable.replace_template是:
- photos.templates.index
- photos.templates.gallery
- photos.templates.gallery_partial
- photos.templates.albums_partial