Metadata-Version: 2.0
Name: django-removewww
Version: 0.1.2
Summary: A Django middleware application that removes the WWW subdomain
Home-page: https://github.com/richardcornish/django-removewww
Author: Richard Cornish
Author-email: rich@richardcornish.com
License: BSD License
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.8
Classifier: Framework :: Django :: 1.9
Classifier: Framework :: Django :: 1.10
Classifier: Framework :: Django :: 1.11
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content

Django Remove WWW
*********************

|PyPI version|_ |Build status|_

.. |PyPI version| image::
   https://badge.fury.io/py/django-removewww.svg
.. _PyPI version: https://pypi.python.org/pypi/django-removewww

.. |Build status| image::
   https://travis-ci.org/richardcornish/django-removewww.svg?branch=master
.. _Build status: https://travis-ci.org/richardcornish/django-removewww

**Django Remove WWW** is a `Django <https://www.djangoproject.com/>`_ `middleware <https://docs.djangoproject.com/en/1.11/topics/http/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 <https://code.djangoproject.com/ticket/6342>`_ a ``REMOVE_WWW`` setting. Thanks to Daniel Ryan's `GitHub Gist <https://gist.github.com/dryan/290771>`_ for some inspiration.

.. |prepend_www| replace:: ``PREPEND_WWW``
.. _prepend_www: https://docs.djangoproject.com/en/1.11/ref/settings/#prepend-www

* `Package distribution <https://pypi.python.org/pypi/django-removewww>`_
* `Code repository <https://github.com/richardcornish/django-removewww>`_
* `Documentation <https://django-removewww.readthedocs.io/>`_
* `Tests <https://travis-ci.org/richardcornish/django-removewww>`_

Install
=======

.. code-block:: bash

   $ pip install django-removewww

Add to ``settings.py``.

.. code-block:: python

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

   REMOVE_WWW = True

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


