Working with URLs in Python & Django

Reversing

First the basics — navigating within your own app. If you’ve got this in your 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 , but don’t. If you change your mind later and decide you want to pluralize the path to , you’d have to go find every place you’d referenced that path in your codebase and change it. So…

--

--

Senior Software Engineer | www.adriennedomingus.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store