[Answer]-Django basic url slugifying issues

1👍

Regarding the first problem, you would be better off using a redirect for the index.html URL (better for SEO etc.)

from django.views.generic.simple import redirect_to

urlpatterns = patterns('',
    url(r'^$', 'myapp.main.views.home')
    url(r'^index.html$', redirect_to, {'url': '/'}),
)

Regarding the second issue, your urls.py file is just a set of regular expressions, so you have control over the URL scheme you want to use:

urlpatterns = patterns('',
    url(r'^warehouse_(?P<slug>[_w]+).html$', 'warehouse.views.warehouse_detail'),
)

That said, I think you would be better sticking to the usual convention of slashes

Leave a comment