django-absoluteuri
Absolute URI functions and template tags for Django.
Why
There are times when you need to output an absolute URL (for example, inside an email), but you don’t always have access to the request. These utilities use the Sites Framework if available in order to create absolute URIs.
Installation
Install django-absoluteuri:
pip install django-absoluteuri
Then add it to your INSTALLED_APPS:
INSTALLED_APPS = (
# ...
'django.contrib.sites',
'absoluteuri',
)
django-absoluteuri requires the Sites Framework to be in INSTALLED_APPS well and configured as well.
Settings
The protocol of the uris returned by this library defaults to http. You can specify the protocol with the ABSOLUTEURI_PROTOCOL setting.
# settings.py
ABSOLUTEURI_PROTOCOL = 'https'
# Elsewhere
>>> absoluteuri.build_absolute_uri('/some/path/')
'https://example.com/some/path/'
Filter
Sometimes instead of template tags, it’s easier to use filters. You can do that as well.
{% load absoluteuri %}
<a href="{{ my_object.get_absolute_url|absolutize }}">click here</a>
But there are situations where tag can not be used but filter can.
{% load absoluteuri %}
{% include "some-other-template.html" with url=my_object.get_absolute_url|absolutize %}
Functions
There are also two functions that django-absoluteuri provides, build_absolute_uri and reverse, which are equivalents of request.build_absolute_url and urlresolvers.reverse.
>>> import absoluteuri
>>> my_relative_url = '/path/to/somewhere/'
>>> absoluteuri.build_absolute_uri(my_relative_url)
'http://example.com/path/to/somewhere/'
>>> absoluteuri.reverse('viewname', kwargs={'foo': 'bar'})
'http://example.com/path/to/bar/'
Changelog
2.0.0 (2026-02-18)
Drop support for Python < 3.8
Drop support for Django < 4.2.
Add support for Django 4.2, 5.0, 5.1, 5.2, and 6.0.
Add support for Python 3.10, 3.11, 3.12, 3.13, and 3.14.
1.3.0 (2018-09-04)
Add support for Django 2.1. Remove support for Django < 1.11.
1.2.0 (2016-02-29)
Add absolutize filter. This deprecates the absolutize tag. [#4]
1.1.0 (2015-03-23)
Added ABSOLUTEURI_PROTOCOL settings. [#1]
Documented sites framework requirement.
1.0.0 (2015-03-17)
First release on PyPI.
Metadata
Release files for django-absoluteuri 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_absoluteuri-2.0.0.tar.gz | 8.2 kB | Without provenance | Details for django_absoluteuri-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_absoluteuri-2.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for django_absoluteuri-2.0.0-py2.py3-none-any.whl |
Total release size: 17.3 kB
Release files / django_absoluteuri-2.0.0.tar.gz
| Download URL | django_absoluteuri-2.0.0.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7fbfeac5be2a07c884803881e72d29c21d118817c83f5272ca42c2fec7f7ae3
|
|
BLAKE2b-256 checksum How to use checksums |
ce932cbc2c6d4fb93faf6749927c950bff3771fabbdf2c846e47691677b50cc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / django_absoluteuri-2.0.0-py2.py3-none-any.whl
| Download URL | django_absoluteuri-2.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
153ab4a658dfb25acbffe99883e7fbb587e61d4d60a6942610249731fbfc2a1f
|
|
BLAKE2b-256 checksum How to use checksums |
193b1695495d1bb30e9bb87939b1f272b54a33f8a6d22bf2284b8cc41c4e8e92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for django-absoluteuri 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.