Howard kirjoitti: > > Wondering whether there is example code/docs relating to models > without databases, but where individual model instances are mapped to > (say) a file. Alternatively put, where the back-end data store for the > app are files, not DB tables. Despite much searching I can't find > anything definitive (maybe I am using the wrong search terms) > > We have a directory full of binary files; the file names contain id > and date information for crude indexing. New files are created by an > external process throughout the day. Each binary file is essentially a > single model instance. In essence, we want to browse the files on the > web. We have existing python code to read the files. There will be no > file writes, only reads. > > I am reluctant to use any DB so as to keep things very simple as the > code could end up in an embedded and "offline" remote system, so less > is more. > > Is it just a question of overriding Model or is there a simpler way I > am missing?
There is not really simple way achieve all that. Django more or less assumes that you have SQL and python DB API compliant backend. Since you like files, what's wrong with SQLite? It's embedded file based database engine. You can rather easily write piece of code that injects your file objects in sqlite database and then use standard django access to read them. Since you already have code to read, making code to inject new entries to sqlite db is quite trivial. And since sqlite is embededd it doesn't need externel dependencies. And it's been included in python since version 2.5. -- Jani Tiainen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

