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#resultsThe 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.
GET /projects/?status=active&page=2 HTTP/1.1
Host: example.comThe 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.
/projects/?status=active
/projects/?search=django
/projects/?page=2A query string often filters, searches, sorts, or paginates a result. Multiple parameters are separated with &. The view decides whether and how to use them.
project%20plan
filter=active%26urgent
search=project+hubSome 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.
/projects/ → project_list view
/projects/42/ → project_detail viewDjango 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=activehttps://example.com/app/dashboard/?status=activeKeep the current path and replace its query.#resultshttps://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.
- Browser URLhttps://example.com/projects/?status=active&page=2#results
- URL path/projects/
- Django URL routingMatches a path pattern.
- 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
- Find the scheme and hostThey tell the browser how to communicate and which server to locate.
- Read the pathIt identifies the web resource the application should handle.
- 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.
