Working with URLs in Python & Django
Reversing
First the basics — navigating within your own app. If you’ve got this in your urls.py
file:
from django.conf.urls import url
from paths import views
urlpatterns = (
url(r'^some/path/here$', views.path_view, name='path_view'),
)
It would work to write something like return redirect('some/path/here')
, but don’t. If you change your mind later and decide you want to pluralize the path to 'some/paths/here
, you’d have to go find every place you’d referenced that path in your codebase and change it. So…