[Answer]-Is it possible to create data-driven URLs in Django?

1👍

Check django’s urlconf docs.

An example:

# URLconf
from django.conf.urls import patterns, url

urlpatterns = patterns('',
    url(r'^blog/$', 'blog.views.page'),
    url(r'^blog/page(?P<num>\d+)/$', 'blog.views.page'),
)

# View (in blog/views.py)
def page(request, num="1"):
    # Output the appropriate page of blog entries, according to num.
    ...

In your case the dynamic param, would be what looks like a page slug, which you would then look up using.

Leave a comment