django-allow-cidr


Namedjango-allow-cidr JSON
Version 0.7.1 PyPI version JSON
download
home_pagehttps://github.com/mozmeao/django-allow-cidr
SummaryA Django Middleware to enable use of CIDR IP ranges in ALLOWED_HOSTS.
upload_time2023-07-10 13:34:56
maintainer
docs_urlNone
authorPaul McLanahan
requires_python
licenseApache Software License 2.0
keywords django-allow-cidr
VCS
bugtrack_url
requirements Django
Travis-CI No Travis.
coveralls test coverage
            =============================
Django Allow CIDR
=============================

.. image:: https://badge.fury.io/py/django-allow-cidr.svg
    :target: https://badge.fury.io/py/django-allow-cidr

.. image:: https://github.com/mozmeao/django-allow-cidr/actions/workflows/ci.yml/badge.svg
   :target: https://github.com/mozmeao/django-allow-cidr/actions


A Django Middleware to enable use of CIDR IP ranges in ALLOWED_HOSTS.

Quickstart
----------

Install Django Allow CIDR::

    pip install django-allow-cidr

Add the Middleware to your ``MIDDLEWARE`` settings. It should be the first in the list:

.. code-block:: python

    MIDDLEWARE = (
        'allow_cidr.middleware.AllowCIDRMiddleware',
        ...
    )

Add the ``ALLOWED_CIDR_NETS`` setting:

.. code-block:: python

    ALLOWED_CIDR_NETS = ['192.168.1.0/24']

Profit!

Features
--------

* The normal ``ALLOWED_HOSTS`` values will also work as intended. This Middleware is intended to augment,
  not replace, the normal Django function.
* If you do define ``ALLOWED_CIDR_NETS`` and it has values, the middleware will capture what you have in `ALLOWED_HOSTS`,
  set ``ALLOWED_HOSTS`` to `['*']` and take over validation of host headers.
* The ``ALLOWED_CIDR_NETS`` values can be any valid network definition for the `netaddr`_ package.

Running Tests
-------------

Does the code actually work?

::

    source <YOURVIRTUALENV>/bin/activate
    (myenv) $ pip install tox
    (myenv) $ tox


Pushing to PyPI
---------------
Cutting a new Github Release will trigger CI checks, followed by an automatic release to PyPI, using the release version.
Please make sure that your Github Release version matches the project version in `__init__.py`.

For more details see the `release` job in  `.github/workflows/ci.yml`.


Credits
-------

Tools used in rendering this package:

*  Cookiecutter_
*  `cookiecutter-djangopackage`_

.. _netaddr: https://netaddr.readthedocs.io/en/latest/
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage




History
-------

0.7.1 (2023-07-10)
++++++++++++++++++

* Update setup.cfg to rename deprecated licence_file param


0.7.0 (2023-07-10)
++++++++++++++++++

* Add IPv6 support - thanks @rissson!
* Add Django 4.2 to CI; freshen up CI config


0.6.0 (2023-01-05)
++++++++++++++++++

* Drop dev-related dependencies (incl vulnerable version of wheel, which was not installed in general use)
* Remove redundant code from setup.py now we're auto-publishing via Github
* Update testing matrix: Drop Python 3.6; add Python 3.11; add Django 4.1

0.5.0 (2022-07-09)
++++++++++++++++++

* Replace the netaddr dependency with Python 3's ipaddress - thanks @n1ngu!
* Update GH actions to release to PyPI

0.4.1 (2022-06-13)
++++++++++++++++++

* Use packaging.version to avoid distutils deprecated module - thanks @adamantike!

0.4.0 (2022-02-22)
++++++++++++++++++

* Drop Django support for non-LTS and non-latest Django (so, removing 1.x, 2.0, 2.1, 3.0, 3.1)
* Drop support for older Python releases (2.x, 3.5)
* Add Django 4.0 to tox's test matrix
* Add Python 3.7 through 3.10 to tox's test matrix; 3.6 to 3.10 are now the only tested versions
* Switch CI to Github Actions

0.3.1 (2018-07-31)
++++++++++++++++++

* Fix issue #6: Accept passed in `get_response` function for Middleware in Django >= 1.10.
* Publish updated docs that fix the `ALLOWED_CIDR_NETS` typo.

0.3.0 (2018-02-21)
++++++++++++++++++

* Disable middleware if ALLOWED_HOSTS is set to `['*']`.

0.2.0 (2018-02-21)
++++++++++++++++++

* Handle host names with ports (Thanks Giorgos!).

0.1.0 (2018-02-16)
++++++++++++++++++

* First release on PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mozmeao/django-allow-cidr",
    "name": "django-allow-cidr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django-allow-cidr",
    "author": "Paul McLanahan",
    "author_email": "pmac@mozilla.com",
    "download_url": "https://files.pythonhosted.org/packages/2c/7f/98dd15aeed94160ef25f41bdaf363a7cf5904ca469f3dda50d56558220c3/django-allow-cidr-0.7.1.tar.gz",
    "platform": null,
    "description": "=============================\nDjango Allow CIDR\n=============================\n\n.. image:: https://badge.fury.io/py/django-allow-cidr.svg\n    :target: https://badge.fury.io/py/django-allow-cidr\n\n.. image:: https://github.com/mozmeao/django-allow-cidr/actions/workflows/ci.yml/badge.svg\n   :target: https://github.com/mozmeao/django-allow-cidr/actions\n\n\nA Django Middleware to enable use of CIDR IP ranges in ALLOWED_HOSTS.\n\nQuickstart\n----------\n\nInstall Django Allow CIDR::\n\n    pip install django-allow-cidr\n\nAdd the Middleware to your ``MIDDLEWARE`` settings. It should be the first in the list:\n\n.. code-block:: python\n\n    MIDDLEWARE = (\n        'allow_cidr.middleware.AllowCIDRMiddleware',\n        ...\n    )\n\nAdd the ``ALLOWED_CIDR_NETS`` setting:\n\n.. code-block:: python\n\n    ALLOWED_CIDR_NETS = ['192.168.1.0/24']\n\nProfit!\n\nFeatures\n--------\n\n* The normal ``ALLOWED_HOSTS`` values will also work as intended. This Middleware is intended to augment,\n  not replace, the normal Django function.\n* If you do define ``ALLOWED_CIDR_NETS`` and it has values, the middleware will capture what you have in `ALLOWED_HOSTS`,\n  set ``ALLOWED_HOSTS`` to `['*']` and take over validation of host headers.\n* The ``ALLOWED_CIDR_NETS`` values can be any valid network definition for the `netaddr`_ package.\n\nRunning Tests\n-------------\n\nDoes the code actually work?\n\n::\n\n    source <YOURVIRTUALENV>/bin/activate\n    (myenv) $ pip install tox\n    (myenv) $ tox\n\n\nPushing to PyPI\n---------------\nCutting a new Github Release will trigger CI checks, followed by an automatic release to PyPI, using the release version.\nPlease make sure that your Github Release version matches the project version in `__init__.py`.\n\nFor more details see the `release` job in  `.github/workflows/ci.yml`.\n\n\nCredits\n-------\n\nTools used in rendering this package:\n\n*  Cookiecutter_\n*  `cookiecutter-djangopackage`_\n\n.. _netaddr: https://netaddr.readthedocs.io/en/latest/\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage\n\n\n\n\nHistory\n-------\n\n0.7.1 (2023-07-10)\n++++++++++++++++++\n\n* Update setup.cfg to rename deprecated licence_file param\n\n\n0.7.0 (2023-07-10)\n++++++++++++++++++\n\n* Add IPv6 support - thanks @rissson!\n* Add Django 4.2 to CI; freshen up CI config\n\n\n0.6.0 (2023-01-05)\n++++++++++++++++++\n\n* Drop dev-related dependencies (incl vulnerable version of wheel, which was not installed in general use)\n* Remove redundant code from setup.py now we're auto-publishing via Github\n* Update testing matrix: Drop Python 3.6; add Python 3.11; add Django 4.1\n\n0.5.0 (2022-07-09)\n++++++++++++++++++\n\n* Replace the netaddr dependency with Python 3's ipaddress - thanks @n1ngu!\n* Update GH actions to release to PyPI\n\n0.4.1 (2022-06-13)\n++++++++++++++++++\n\n* Use packaging.version to avoid distutils deprecated module - thanks @adamantike!\n\n0.4.0 (2022-02-22)\n++++++++++++++++++\n\n* Drop Django support for non-LTS and non-latest Django (so, removing 1.x, 2.0, 2.1, 3.0, 3.1)\n* Drop support for older Python releases (2.x, 3.5)\n* Add Django 4.0 to tox's test matrix\n* Add Python 3.7 through 3.10 to tox's test matrix; 3.6 to 3.10 are now the only tested versions\n* Switch CI to Github Actions\n\n0.3.1 (2018-07-31)\n++++++++++++++++++\n\n* Fix issue #6: Accept passed in `get_response` function for Middleware in Django >= 1.10.\n* Publish updated docs that fix the `ALLOWED_CIDR_NETS` typo.\n\n0.3.0 (2018-02-21)\n++++++++++++++++++\n\n* Disable middleware if ALLOWED_HOSTS is set to `['*']`.\n\n0.2.0 (2018-02-21)\n++++++++++++++++++\n\n* Handle host names with ports (Thanks Giorgos!).\n\n0.1.0 (2018-02-16)\n++++++++++++++++++\n\n* First release on PyPI.\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "A Django Middleware to enable use of CIDR IP ranges in ALLOWED_HOSTS.",
    "version": "0.7.1",
    "project_urls": {
        "Homepage": "https://github.com/mozmeao/django-allow-cidr"
    },
    "split_keywords": [
        "django-allow-cidr"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1129b55a90a9a092a0c3a8d7aecdb5e18d9148cf6ce64aa3c3c762f533b0995",
                "md5": "0af571d1b7e4cbe99449fa322e888623",
                "sha256": "11126c5bb9df3a61ff9d97304856ba7e5b26d46c6d456709a6d9e28483bff47f"
            },
            "downloads": -1,
            "filename": "django_allow_cidr-0.7.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0af571d1b7e4cbe99449fa322e888623",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 4965,
            "upload_time": "2023-07-10T13:34:54",
            "upload_time_iso_8601": "2023-07-10T13:34:54.965234Z",
            "url": "https://files.pythonhosted.org/packages/b1/12/9b55a90a9a092a0c3a8d7aecdb5e18d9148cf6ce64aa3c3c762f533b0995/django_allow_cidr-0.7.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c7f98dd15aeed94160ef25f41bdaf363a7cf5904ca469f3dda50d56558220c3",
                "md5": "86e2ae8ab3672592c287e6b79ad64757",
                "sha256": "382c5d7a9807279e3e96e4f4892b59163a2b30128c596902bf5f80e133e1ccbb"
            },
            "downloads": -1,
            "filename": "django-allow-cidr-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "86e2ae8ab3672592c287e6b79ad64757",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6958,
            "upload_time": "2023-07-10T13:34:56",
            "upload_time_iso_8601": "2023-07-10T13:34:56.618870Z",
            "url": "https://files.pythonhosted.org/packages/2c/7f/98dd15aeed94160ef25f41bdaf363a7cf5904ca469f3dda50d56558220c3/django-allow-cidr-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 13:34:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mozmeao",
    "github_project": "django-allow-cidr",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "Django",
            "specs": [
                [
                    ">=",
                    "2.2"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "django-allow-cidr"
}
        
Elapsed time: 0.15657s