Skip to main content

A Django middleware application that removes the WWW subdomain

Project description

PyPI version Build status

Django Remove WWW is a Django middleware application that removes the WWW subdomain.

The middleware inspects the request’s host for the www subdomain, and redirects if REMOVE_WWW is True. It silently passes if PREPEND_WWW is also True. For some reason, Django won’t include a REMOVE_WWW setting. Thanks to Daniel Ryan’s GitHub Gist for some inspiration.

Install

$ pip install django-removewww

Add to settings.py.

MIDDLEWARE = [
    # ...
    'removewww.middleware.RemoveWwwMiddleware',
]

REMOVE_WWW = True

Adding to INSTALLED_APPS is unnecessary unless you want to run the tests.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-removewww-0.1.2.tar.gz (3.2 MB view hashes)

Uploaded Source

Built Distribution

django_removewww-0.1.2-py2.py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page