Skip to main content

A helper function for creating Django views from a YAML file of URL paths

Project description

A helper function for creating views from a YAML file of URL paths


.. code:: bash

pip install canonicalwebteam.views-from-yaml


E.g. create a YAML file:

.. code:: yaml
# url-settings.yaml
some/url/path: {"content": "Hello world!"}
another/path: {"content": "Different content"}

And edit your Django app's ````\:

.. code:: python

# django_app/

from canonicalwebteam.views_from_yaml import load_views_from_file

def url_view(request, url_settings):
return HttpResponse(url_settings['content'])

urlpatterns = load_views_from_file(

Now if you visit `http://your-django-site/some/url/path` you should see
"Hello world!".

Project details

Download files

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

Files for canonicalwebteam.views-from-yaml, version 0.2.3
Filename, size File type Python version Upload date Hashes
Filename, size canonicalwebteam.views-from-yaml-0.2.3.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page