# HG changeset patch # User Sandrine Ribeau # Date 1238633624 25200 # Node ID 47a3eb4bbe66db93df9b8d16e689940828d9b8ff # Parent 4ec80ee57b19e340930388d006ea7b61d1981ef7 [doc] Adds a short section on how to launch a blog based on the packages cubicweb and cubicweb-blog. Needs review and renaming to follow convention if content is approved. diff -r 4ec80ee57b19 -r 47a3eb4bbe66 doc/book/en/A020-tutorial.en.txt --- a/doc/book/en/A020-tutorial.en.txt Wed Apr 01 17:52:00 2009 -0700 +++ b/doc/book/en/A020-tutorial.en.txt Wed Apr 01 17:53:44 2009 -0700 @@ -20,6 +20,7 @@ This tutorial will show how to create a `cube` and how to use it as an application to run an `instance`. +.. include:: Z013-blog-less-ten-minutes.en.txt .. include:: A02a-create-cube.en.txt .. include:: A02b-components.en.txt .. include:: A02c-maintemplate.en.txt diff -r 4ec80ee57b19 -r 47a3eb4bbe66 doc/book/en/Z013-blog-less-ten-minutes.en.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/book/en/Z013-blog-less-ten-minutes.en.txt Wed Apr 01 17:53:44 2009 -0700 @@ -0,0 +1,84 @@ +.. -*- coding: utf-8 -*- + +Have a blog ready in less than ten minutes! +------------------------------------------- + +Installation +~~~~~~~~~~~~ + +You need to install the following packages:: + + cubicweb, cubicweb-blog + +The package `cubicweb` is installing the command `cubicweb-ctl` that +will allow you to create new application. + +The package `cubicweb-blog` is installing the blogging support for the +`CubicWeb` framework. + +Application creation +~~~~~~~~~~~~~~~~~~~~ + +Creation and initialization of your application by running:: + + cubicweb-ctl create blog myblog + +*myblog* is the name of the application you are creating. + +*blog* is the name of the component on which your application +is based. + +Application launch +~~~~~~~~~~~~~~~~~~ + +Your application is now ready to go:: + + cubicweb-ctl start -D myblog + +This is it. Your blog is ready to you. Go to http://localhost:8080 and enjoy!! + + +A little code snapshot from behind the scene +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The component `blog`, referred as a `cube` in the book +(see :ref:`TermsVocabulary` for a complete definition), defines +a data model in ``/usr/share/cubicweb/cubes/blog/schema.py``. +Here is the corresponding Python code:: + + from cubicweb.schema import format_constraint + + class Blog(EntityType): + title = String(maxsize=50, required=True) + description_format = String(meta=True, internationalizable=True, maxsize=50, + default='text/rest', constraints=[format_constraint]) + description = String() + rss_url = String(maxsize=128, description=_('blog\'s rss url (useful for when using external site such as feedburner)')) + + + class BlogEntry(EntityType): + title = String(required=True, fulltextindexed=True, maxsize=256) + content_format = String(meta=True, internationalizable=True, maxsize=50, + default='text/rest', constraints=[format_constraint]) + content = String(required=True, fulltextindexed=True) + entry_of = SubjectRelation('Blog', cardinality='?*') + +Two types of entities are defined here: Blog and BlogEntry. + +A Blog is defined by a title, a description and its format and a +RSS URL to provide RSS feed. + +A BlogEntry is defined by a title, a content and its format and +a relation to a Blog, meaning a BlogEntry belongs to a Blog. + + +Next step +~~~~~~~~~ + +This was a brief demonstration of the re-usability of cubes and a way +to show how you can use `CubicWeb` straigth out of the box. + +As a developper, you'll want to know more about how to develop new +cubes and cutomize the views and this is what we talk about now. + +