支持sqlalchemy和mongodb的turbogears2可插拔博客
tgapp-turbopress的Python项目详细描述
关于TGAP涡轮增压器
TurboPress是TurboGears2的一个可插入的极简博客。 它实现了带有附件和标签支持的文章。 使用ckeditor进行内容编辑。 它同时支持sqla和ming orm。
安装
tgapp涡轮增压器既可以从pypi安装,也可以从bitbucket安装:
pip install tgapp-turbopress
应该只对大多数用户有效
插入涡轮增压器
在应用程序中config/app_cfg.py导入plug:
from tgext.pluggable import plug
然后在文件的结尾处,用TurboPress调用插头:
plug(base_config, 'turbopress')
再次运行gearbox setup app development.ini以创建 有关TurboPress的表格并启动应用程序。 您可以访问 http://localhost:8080/按。管理图形用户界面 将在与以下用户一起登录时可用 拥有turbopress权限。
多个博客支持
默认情况下,TurboPress只支持一个博客,但它支持 初步的多博客实现。搜索和标记云将 被所有的博客分享,但是可以过滤文章 只管理一个博客的文章。
要创建博客访问/press/blogs并创建新的访问, 然后您将能够访问子博客并通过访问 /按/blogname
暴露部分
涡轮压力机暴露了一堆可以使用的部分 在您的 应用程序:
- turbopress.partials:articles -> Renders the list of articles
- turbopress.partials:article_preview -> Renders the preview of an article
- turbopress.partials:tagcloud -> Renders the blog tagcloud section
- turbopress.partials:search -> Renders the blog search section
- turbopress.partials.excerpts -> Renders excerpts of a list of articles
- turbopress.partials.excerpt -> Renders the excerpt of an article
可用挂钩
TurboPress公开了一些钩子和选项来配置它的 方面。
可传递给plug的选项调用:
- form -> Full python path of the form class to use for the Article form. By default turbopress.lib.forms.ArticleForm is used.
可与涡轮齿轮2寄存器挂钩一起使用的挂钩是:
- turbopress.before_create_article(article, values) -> Runs before the creation of an article
- turbopress.after_create_article(article, values) -> Runs after the creation of an article, makes possible to set additional data for newly created articles
- turbopress.before_edit_article(article, values) -> Runs before displaying the edit article form, makes possible to load additional form values
- turbopress.before_save_article(article, values) -> Runs before saving the article after it got edited, makes possible to update additional data for the article.