Skip to content
This repository has been archived by the owner on Oct 8, 2018. It is now read-only.

canonical-web-and-design/yaml-redirects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated

This module has been replaced by canonicalwebteam.yaml-responses. You should use that instead.


Usage

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

from django_yaml_redirects import load_redirects

urlpatterns = load_redirects()
urlpatterns += patterns(...)

Format of redirects.yaml

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

# redirects.yaml

getubuntu/download_static: http://www.ubuntu.com/netbook/get-ubuntu/download

# Also supports regex:
testing/.+/alpha1/?:       https://wiki.ubuntu.com/QuantalQuetzal/TechnicalOverview/Alpha1

# And named groups
placeone/(?P<something>.+)/?: /place2/{something}