Skip to content

Latest commit

 

History

History
85 lines (58 loc) · 2.27 KB

README.rst

File metadata and controls

85 lines (58 loc) · 2.27 KB

django-ok-redirects PyPI version

Build status Code health Python versions PyPI downloads Software license Project Status

Simple Redirects App, which is particularly useful in the cases where you want to update some existing URLs without compromising your Website SEO.

Installation

Install with pip:

$ pip install django-ok-redirects

Update INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'ok_redirects',
    ...
]

Make migrations

$ python manage.py migrate

Available settings

REDIRECTS_IGNORE_PATH_PREFIXES - Tuple of path prefixes to ignore.

For example:

REDIRECTS_IGNORE_PATH_PREFIXES = (
    '/api/v1/',
    '/uploads/',
    '/static/',
)

Basic example to use:

Add the redirects middleware to the MIDDLEWARE configuration:

MIDDLEWARE = [
    ...

    'ok_redirects.middleware.RedirectMiddleware'
]