Added some documentation for the example project, support to start it directly and small touches on the docs

git-svn-id: https://django-dbtemplates.googlecode.com/svn/trunk@79 cfb8ba98-e953-0410-9cff-959ffddf5974

committer: leidel <leidel@cfb8ba98-e953-0410-9cff-959ffddf5974>

--HG--
extra : convert_revision : 541571d5a5f1a13dc5f65b26fef6a4e93201ee90
This commit is contained in:
leidel 2008-11-16 02:03:22 +00:00
parent e786c1bca3
commit 19794cb5cc
3 changed files with 55 additions and 2 deletions

View file

@ -5,7 +5,9 @@ To install it, run the following command inside this directory:
Or if you'd prefer you can simply place the included ``dbtemplates``
directory somewhere on your Python path, or symlink to it from
somewhere on your Python path; this is useful if you're working from a
Subversion checkout.
Subversion checkout. Since ``dbtemplates`` is registered in the
Python Package Index you can also run ``easy_install django-dbtemplates``
or ``pip django-dbtemplates`` optionally.
Note that this application requires Python 2.3 or later, and a recent
Subversion checkout of Django. You can obtain Python from

View file

@ -12,10 +12,15 @@ of the templates saved in the database.
.. _template loader: http://docs.djangoproject.com/en/dev/ref/templates/api/#loading-templates
.. contents:: Table of Contents
:backlinks: none
Setup
=====
1. Get the source from the subversion repository
1. Get the source from the `Mercurial repository`_ or install it from the
Python Package Index by running ``easy_install django-dbtemplates`` or
``pip django-dbtemplates``.
2. Follow the instructions in the INSTALL file
3. Edit the settings.py of your Django site:
@ -51,6 +56,8 @@ Setup
4. Sync your database ``python manage.py syncdb``
5. Restart your Django server
.. _Mercurial repository: http://bitbucket.org/jezdez/django-dbtemplates/
Usage
=====
@ -71,6 +78,46 @@ contents in the database, you just need to leave the content field empty to
automatically populate it. That's especially useful if you don't want to
copy and paste its content manually to the textarea.
Example
=======
``dbtemplates`` comes with an example Django project that let's you try it
out. The example uses Django's own `flatpages app`_ to enable you to create
a simple page using ``dbtemplates``. Flat pages are a perfect fit to
dbtemplates since they come prepackaged and are simple to use.
Here is how it works:
1. Open your command line and change to the ``example`` directory in the
directory with the extracted source distribution.
2. Run ``python manage.py syncdb`` and follow the instructions.
3. Run ``python manage.py runserver`` and open your favorite browser with the
address http://127.0.0.1:8000/admin/.
4. Next add a new `Template` object in the ``dbtemplates`` section and use
``flatpages/default.html`` as the value for the ``name`` field. For the
``content`` field use this example::
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>{{ flatpage.title }}</title>
</head>
<body>
{{ flatpage.content }}
</body>
</html>
5. Return to the home screen of the admin interface and add a new flat page.
Use ``/`` (yep, just a forward slash) and whatever ``title`` and
``content`` you prefer. Please make sure you select the default site
``example.com`` before you save the flat page.
6. Visit http://127.0.0.1:8000/ and see the flat page you just created
rendered with the ``flatpages/default.html`` template provided by
``dbtemplates``.
.. _flatpages app: http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/
Caching
=======

View file

@ -1,5 +1,9 @@
#!/usr/bin/env python
import os, sys
from django.core.management import execute_manager
sys.path.insert(0, os.path.abspath('./..'))
try:
import settings # Assumed to be in the same directory.
except ImportError: