diff -r 4fc48f2a1748 -r 8e7a99cbce3c doc/book/en/Z013-blog-less-ten-minutes.en.txt --- a/doc/book/en/Z013-blog-less-ten-minutes.en.txt Wed Apr 22 21:43:06 2009 -0700 +++ b/doc/book/en/Z013-blog-less-ten-minutes.en.txt Wed Apr 22 21:44:14 2009 -0700 @@ -1,92 +1,26 @@ .. -*- coding: utf-8 -*- -.. BlogTenMinutes: - -Have a blog ready in less than ten minutes! -------------------------------------------- - -We picked the example of a Blog as this is familiar to any developper -as well as none-developper. We could have choose any of the cubes available -on http://www.cubicweb.org. - - -Installation -~~~~~~~~~~~~ +.. _BlogTenMinutes: -You need to install the following packages:: - - cubicweb, cubicweb-blog +Get a Blog running in less than ten minutes! +-------------------------------------------- -The package `cubicweb` is installing the command `cubicweb-ctl` that -will allow you to create new application. +You need to install the following packages (:ref:`DebianInstallation`):: -The package `cubicweb-blog` is installing the blogging support for the -`CubicWeb` framework. - -Application creation -~~~~~~~~~~~~~~~~~~~~ + cubicweb, cubicweb-dev, cubicweb-blog 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!! -You can add content and creates user for your application if you'd like to. - -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)')) +As a developper, you'll want to know more about how to develop new +cubes and cutomize the look of your application and this is what we +talk about now. - 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. - -