Skip to main content

Usage

Import this in urls.py and assign it to urlpatterns BEFORE custom urls. (redirects should be hit first) e.g:

from django_redirects_file import load_redirects

urlpatterns = load_redirects()
urlpatterns += patterns('',
    url(r'^(?P<template>.*)/?$', TemplateFinder.as_view()),
)

Format of redirects.json

The json format is simply key/value pairs, from source to destination:

{
    "getubuntu/download_static": "http://www.ubuntu.com/netbook/get-ubuntu/download",
    "testing/quantal/alpha1":    "https://wiki.ubuntu.com/QuantalQuetzal/TechnicalOverview/Alpha1"
}

To convert old “double spaced” redirects.txt:

json.dumps(dict([
    i.split('  ')[0:2] #ignore the 3rd item, in-line comments
    for i in open('/path/to/redirects.txt').readlines()
    if len(i.split('  ')) >= 2 #ignore whole comment lines
]))

Metadata

Release files for django-redirects-file 0.1.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-redirects-file 0.1.1
File Size Uploaded Provenance Actions
django-redirects-file-0.1.1.tar.gz 4.7 kB Without provenance Details for django-redirects-file-0.1.1.tar.gz

Release files / django-redirects-file-0.1.1.tar.gz

Download URL django-redirects-file-0.1.1.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8ada702daa7c0d824b185149e7850e6a7c8bbcbff002cbed8fabf7d18667c625
BLAKE2b-256 checksum
How to use checksums
8f5bbd6c6f800a1c416e25321d71dd0d6085acd9080164a54e6065d60b66f8d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-redirects-file 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

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