Skip to main content

Provides {{ ASSET_SERVER_URL }} (the URL for an asset server) as a template context variable. Can be set through settings.py or by passing an environment variable to the app.

Setup

# settings.py
TEMPLATE_CONTEXT_PROCESSORS += [
    "assets_template_context.asset_server_url"
]

Definition

Set it in settings, e.g.:

# settings.py
ASSET_SERVER_URL = '//assets.example.com/'

Or when starting the site, e.g.:

ASSET_SERVER_URL=//assets.example.com/ python manage.py runserver

Usage

Use in templates:

# templates/index.html

<img src="{{ ASSET_SERVER_URL }}a34bc3-fish.jpg" />

Output:

<img src="//assets.example.com/a34bc3-fish.jpg"

Metadata

Release files for django-asset-server-url 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-asset-server-url 0.1
File Size Uploaded
django-asset-server-url-0.1.tar.gz 4.4 kB Details

Release files / django-asset-server-url-0.1.tar.gz

Download URL django-asset-server-url-0.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cc0f97d6f518d028eed1502c641f18a5ab88f33ef960feae6a76b5bb7afe3eac
BLAKE2b-256 checksum
How to use checksums
b5b20358b2c17a8bbf3262da5062d12e5dc0df20cb081e5c75afcb21ad6ffbb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page