On Thu, 2006-10-05 at 10:33 -0400, David Abrahams wrote:
[...]
> I don't think either of these approaches quite works for me.  Maybe
> "static content" is a misnomer here.  The content needs to be
> _generated_ but from files that are largely static.  The
> distinguishing characteristic is that the content of these files is
> not the result of some interaction with the user, and so is not stored
> in the database.  For example, I might have a directory hierarchy of
> page bodies checked into source control:
> 
>    content/
>        index.rst
>        about.rst
>        company/
>             contact.rst
>             history.rst
>        projects/
>             foobar-corp.rst
>             acme-anvils.rst
> 
> I want the following URLs:
> 
>     http://mysite.net/index.html
>     http://mysite.net/about.html
>     http://mysite.net/company/contact.html
>     http://mysite.net/company/history.html
>     http://mysite.net/projects/foobar-corp.html
>     http://mysite.net/projects/acme-anvils.html
> 
> Let's say each page should be generated by processing the
> corresponding .rst file with docutils to get HTML for the main body of
> the page, and combining that with some template that provides sidebars
> and menus.

Unclear how you are going to generate your sidebars and menus, but in
any case, this isn't too hard, if you just step back and try to
implement it exactly as you describe:

Each of these URL's dispatches to a view (it could be the same view each
time -- might as well be, since the tail of the URL tells you where the
source file is in your example) that reads in the appropriate RST file,
converts it to HTML and then passes that data in a context to a template
for final rendering. You could have template tags that construct the
sidebars and menus or have them triggered from data you pass in via the
context as well; up to you how you would prefer to do that.

Converting from RST to HTML is something you presumably already know how
to do. After that it's just a call to render_to_response() as normal in
Django.

This is, in effect, what the documentation pages at
www.djangoproject.com/documentation/ are doing, since they are generated
from the Restructured Text source files that are shipped with Django.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to