Karl Fast wrote:
> Can anyone point me to examples of django apps that either do not use
> a database, or use it for only part of the app? Looking for source.
> 
> I'm specifically interested in examples with models that use other
> persistence backends (like a config file), and the associated
> views and templates.

My first cut with django used RDF files for data (this is ancien code, 
django has changed since then):

[[[
from django.core import template_loader
from django.core.extensions import DjangoContext
from django.utils.httpwrappers import HttpResponse
from django.core import formfields
from rdflib.StringInputSource import StringInputSource
import time
from mobius.apps.contacts.models import contacts
from mobius import About

def index(request):
     contacts_list = contacts.get_contacts()
     contacts_list.sort(sortCodes)
     date = time.ctime()
     t = template_loader.get_template('contacts/index')
     about = About()
     c = DjangoContext(request, {
         'contacts_list': contacts_list,
         'date': date,
         'pmr': about,
     })
     return HttpResponse(t.render(c))
]]]


get_contacts looked like this (rdflib with sparta):

[[[
def get_contacts():
     store, schema_store = TripleStore(), TripleStore()
     ds = DataStore()
     ds.loadData(CONTACTS_HOME, store)
     f = open(PMR_SCHEMA_LOC)
     rdfxml= "".join(f.readlines())
     f.close()
     schema_store.parse(StringInputSource(rdfxml))
     Thing = ThingFactory(store, schema_store)
     gen = ds.findContactGenerators(store)
     summaries = ds.loadContacts(gen, Thing, store)
     return summaries
]]]

For models and admin usage your storage will need to meet the DBAPI 
contract. I think it can be done, but with considerable effort. I think 
I'd wonder why bother tho' - the main reason I cna think of is for the 
CMS case where users can create

cheers
Bill


--~--~---------~--~----~------------~-------~--~----~
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