I'm completely new to Django so forgive me if this is a dumb question.
In the web site I'm creating many of the pages will not be database
driven.
I am trying to set up my urls.py so that all pages that all extend the
base.html template
can be rendered in the same way. I'm sure that I shouldn't need a
unique pair in urlpatterns
in urls.py for each *.html that I want to show. 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')
and then have a views.py in the mysite 'root' with the function
def showPage(request, page):
t = loader.get_template(page)
c = Context({})
return HttpResponse(t.render(c))
How can I achieve something like this?
I'll be grateful for any help I can get.
/Simon
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment