I tried to get the built-in web server running without database, but
did not succeed.
I modified settings.py, DATABASE_ENGINE = ''
But this did not work.
Any ideas?
Thanks Anja
--
Sincerely,
Vladimir "Farcaller" Pouzanov
http://www.hackndev.com
--
Alexandre CONRAD
--
www.mawei.name
Petit
IM&mail:mawe...@gmail.com
13585201588
No specific installation except the sqlite shared libraries,
and the python bindings (http://initd.org/tracker/pysqlite).
Do you have any reason for not using sqlite?
Accédez au courrier électronique de La Poste : www.laposte.net ;
3615 LAPOSTENET (0,34 €/mn) ; tél : 08 92 68 13 50 (0,34€/mn)
In the latest source code, have a look in the examples directory. There
is a little "hello" application in there that uses the views and
templates without using a database at all. That has a very minimal
settings file as well (so short, I can paste it in full):
# Django settings for the example project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ROOT_URLCONF = 'examples.urls'
You can run that in place to see what happens by setting your PYTHONPATH
to the directory above examples/ and then running "python manage.py
runserver" and it should work (it did for me when I tried it just now).
So if you can get that example running, customising for your own
purposes should be relatively simple.
Regards,
Malcolm
Yes, you can use Django without a DB, in the latest development
version (trunk). A database connection is required in 0.90 and 0.91,
but removing that dependency is one of the many, many improvements we
made in the magic-removal branch, which is now the new development
version.
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com
I'm specifically interested in examples with models that use other
persistence backends (like a config file), and the associated
views and templates.
If you want to do that, you may want to write a model backend which
complies with DBAPI, I think. The models stuff is pretty compelling
and you'll reinvent a big wheel if you have a somewhat complex non-RDB
data store without the models to back it.
As Malcolm pointed out earlier in this thread, the latest Django trunk
comes with an "examples" directory that contains a few example views
that don't use the database.
It's almost absurd to have to explain this -- if you want to use
Django without a database, uh, just don't use any models! :) It's the
same basic premise as: If you want to make a Web page that doesn't
display blinking bright-red text, don't use blinking bright-red text.
If you don't want to receive a letter from yourself in the mail, don't
send yourself a letter in the mail. :)
Facundo
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
> 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
...arbitrary content types (ie autogenerated models). That would be
either table-on-demand or some uber-content-model (a la RDF/CMF/Archetypes)
cheers
Bill