How to Django — URLs and Templates

Developing user experience through URL routes and templating

Emily Y Leung
Geek Culture

--

Photo by AltumCode on Unsplash

As you’re developing your website, it is important to understand that navigation is critical to the success of its user friendly experience.

For this reason, we need to build logic into how we switch between pages and how far we want our user to dive into the content, if it’s layered and multi-faceted.

While it might not seem much, the following post will cover:

  • URL patterns
  • Creating templates
  • Dynamic URLs

URL Patterns

We have already built a url pattern into our website, which doesn’t take in any custom value, yet. http://localhost:8000/ is the default url we are given from Django, but what if we wanted to make it unique to us? Give it a bit of personality and make it our own?

Continuing from the previous post, we can control this through the following files:

  • urls.py
  • views.py

That post only scratched the surface of how the URLs work, so let’s dig a little deeper.

So what we covered previously was creating a simple homepage with the following url: http://localhost:8000/

--

--