I sometimes use the direct_to_template generic view for a different purpose than yours (test a template), but the same URL pattern might be useful to you:
# test a template (r'^direct/(?P<template>.*)$', 'django.views.generic.simple.direct_to_template'), Although you'd better use a better regex to match the template name (like the one you originally used): (r'^(?P<template>[a-zA-Z0-9]*?\.html?)$', 'django.views.generic.simple.direct_to_template') You might also want to take a look at the flatpages app: http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/ which may be an alternative approach to what you are trying to achieve. C. On 1 Oct, 16:52, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On 1 oct, 16:07, simon_saffer <simon.p.saf...@gmail.com> wrote: > (snip) > > My attempt at doing > > > this was to put the following in > > urls.py in urlpatterns > > > (r'^(?P<page>[a-zA-Z0-9]*?\.html?)$', 'mysite.views.showPage') > > hint : named urls are cool > > > and then have a views.py in the mysite 'root' with the function > > is 'mysite' an app in your project, or is it the project itself ? > > > def showPage(request, page): > > hint: Python coding conventions : use all_lower names for functions > > > t = loader.get_template(page) > > c = Context({}) > > > return HttpResponse(t.render(c)) > > hint : use the render_to_response() > hint : use RequestContext if you want your context processors to be of > any use > > > How can I achieve something like this? > > Hmmm... What happened with your above attempt exactly ? I guess it > didn't yield the expected results, but you don't tell what happened > exactly (and when I mean "exactly", it means that if you got a > traceback you should post the _whole_ traceback too). -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.