✦ Web Development with Django Web addresses

L3 · Concept 03 · Web Fundamentals

Navigate the Web with
URLs.

URLs help the browser find a server, request a resource, and navigate within a page. Learn to read each part before Django starts routing paths for you.

Learning goalRead a URL, resolve a relative link, explain query parameters and fragments, and connect a URL path to a future Django view.
01 Learn02 Investigate in your browser03 Check your understanding

Learning as a guest

Learning as a guest? Save your progress!

Create a free account to learn with Sloby AI, check your understanding, and track your progress.

The entire platform is free throughout 2026. Foundations stays free forever.

One URL, several useful clues

Anatomy of a URL

Read the complete address from left to right. Each part has a different purpose.

https://example.com/projects/?status=active&page=2#results
  1. httpsSchemeThe protocol the browser uses.
  2. example.comHostThe server name the browser finds.
  3. 443Default HTTPS portUsed when no explicit port is written.
  4. /projects/PathThe application resource to request.
  5. status=active&page=2Query stringOptional instructions such as filters or a page number.
  6. #resultsFragmentA browser-side target; it is not sent in the HTTP request target.

A URL path is not the same thing as a file path on your computer. A Django application decides what a web path means.

A URL is an address for a web resource

A URL tells a browser where to look for a resource and how to reach it. A domain such as example.com is only the host; the complete URL can also contain a scheme, path, query string, and fragment.

https://example.com/projects/?status=active&page=2#results

The future My Project Hub might use /projects/ for a project list. That path is a web address chosen by the application; it does not have to be a physical folder on the server.

http://localhost:8000/projects/

localhost means this computer. The explicit :8000 is a port, and Django’s development server often uses it. HTTPS normally uses port 443 when no port is written.

↳

Keep URLs appropriate: Query parameters can describe filters, searches, sorting, or pages. ?status=active does not filter projects by itself: the browser sends it as part of the URL request, and the future My Project Hub application can filter by it, ignore it, or handle it differently. Do not put passwords, tokens, or other secrets in a query string.

URL parts in one request
GET /projects/?status=active&page=2 HTTP/1.1
Host: example.com

The browser sends the path and query to the server. The #results fragment stays in the browser for navigation inside a document or other client-side behavior.

Query parameters
/projects/?status=active
/projects/?search=django
/projects/?page=2

A query string often filters, searches, sorts, or paginates a result. Multiple parameters are separated with &. The view decides whether and how to use them.

URL encoding
project%20plan
filter=active%26urgent
search=project+hub

Some characters need encoding so the URL remains unambiguous. %20 represents a space, %26 represents &, and form-style query encoding can use + for a space. You do not need to memorize these values.

Django connection
/projects/     → project_list view
/projects/42/   → project_detail view

Django URL routing matches the request path to choose a view. Query parameters can affect the view’s result, but standard Django URL pattern matching does not use them to choose a pattern.

Absolute and relative URL references

An absolute URL includes its scheme and host, such as <code>https://example.com/projects/</code>. Root-relative and path-relative references are both relative URL references in the technical sense: <code>/projects/</code> starts at the site root, while <code>projects/</code> and <code>../projects/</code> resolve from the current page. In everyday speech, <code>/projects/</code> is often called an absolute path, but it is not a complete absolute URL.

Base URL: https://example.com/app/dashboard/
https://example.com/projects/
https://example.com/projects/Absolute: use exactly this address.
/projects/
https://example.com/projects/Root-relative: start at the site root. It is not a complete absolute URL because it has no scheme or host.
projects/
https://example.com/app/dashboard/projects/Path-relative: append below the current directory.
../projects/
https://example.com/app/projects/Path-relative: go up one path segment, then enter projects.
?status=active
https://example.com/app/dashboard/?status=activeKeep the current path and replace its query.
#results
https://example.com/app/dashboard/#resultsKeep the page and target a fragment.

The trailing slash matters here: the base ends with <code>/</code>, so the browser treats <code>dashboard/</code> as a directory when resolving <code>projects/</code>.

From URL to a Django view

Later, Django will use the path portion of a browser URL to decide which view should respond.

  1. Browser URLhttps://example.com/projects/?status=active&page=2#results
  2. URL path/projects/
  3. Django URL routingMatches a path pattern.
  4. ViewBuilds the response; it can also read query parameters.

The query string remains available to the view, but it is not part of ordinary Django URL pattern matching.

Read a URL step by step

  1. Find the scheme and hostThey tell the browser how to communicate and which server to locate.
  2. Read the pathIt identifies the web resource the application should handle.
  3. Read query and fragment separatelyThe query is sent with the request; the fragment stays in the browser.

Avoid these URL shortcuts

  • A domain is the whole URLThe host is one part. A path, query, and fragment can change what the browser does.
  • A fragment is sent to the serverThe browser keeps the fragment. The server receives the request path and query, not #results.

Guided Lab — URL Detective

Do this in your browser

Use a public page you can safely inspect, or a local page in this platform. Do not copy cookies, Authorization headers, tokens, passwords, or private query values.

URL investigation checklist
Browser
└── Address bar
    └── Developer Tools
        └── Network

Use the visible URL to practice reading parts. In Network, the request target will not include a fragment after #.

Investigate a URL safely

  1. Read prepared URLsLabel the scheme, host, path, query, and fragment in the examples from this lesson.
    https://example.com/projects/?status=active&page=2#results
  2. Predict a relative linkYou are at https://example.com/app/dashboard/ and click ../projects/. Predict the destination without revealing it here, then check your thinking in the Predict exercise below the theory.
  3. Open a safe pageOpen a public documentation page or a page in this app. Do not assume that example.com/projects/ exists; it is only an illustration.
  4. Change a harmless query valueIf the safe page already has a non-private query parameter, change its value and observe the address. The page decides whether it has an effect.
  5. Add a fragmentAdd a fragment such as #results to a suitable page and observe browser navigation. A fragment may do nothing when no matching target exists.
  6. Check what reaches the serverOpen Network, reload, and compare the requested path and query with the address bar. Confirm that the fragment is absent from the request target.
↳

Expected observation: Address bar: /projects/?status=active#results Request target: /projects/?status=active The exact page behavior varies. The important comparison is that the request can include the path and query, while the fragment remains browser-side.

When URL behavior is surprising

  • A relative link goes somewhere unexpectedWrite the complete base URL first. Check whether its path ends with <code>/</code>, then resolve one segment at a time.
  • Changing a query does nothingThat is normal when the application does not use that parameter. Query text is only input for the application to interpret.
  • The fragment is missing in NetworkThat is expected. The browser does not send the fragment as part of the HTTP request target.
↳

In the next Django lessons, you will define URL patterns that connect paths such as /projects/ to views.

A page is open at the base URL below. What address does the relative reference resolve to?

Follow the path one segment at a time.

Base: https://example.com/app/dashboard/
Reference: ../projects/
Choose the output

Build confidence independently

Design URLs for My Project Hub

Propose a small, consistent URL structure before any Django project exists.

Your goalWrite URLs for a project list, one project detail, active-project filtering, a second result page, and navigation to a results section.
/projects/
/projects/42/
/projects/?status=active
/projects/?page=2
/projects/#results

Use your own notes or a local text file

Progressive hints
  • Use a path for a resource or detail, not a computer file path.
  • Use query parameters for optional filtering and pagination.
  • Use a fragment only for a browser-side location within a document.

Ask Sloby for a guiding question about one path, query, or fragment. Do not paste private URLs or credentials.

Sloby, the Python AI Tutor mascot

Your learning mentor

Sign in to ask Sloby

Create a free account or sign in to get AI guidance while you learn.

Sign in to check your understanding

Create a free account or sign in to receive AI feedback and save your learning progress.

Python AI Tutor · Learn by understanding, not just by running code.