canonicalwebteam.views-from-yaml

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


Install
pip install canonicalwebteam.views-from-yaml==0.2.3

Documentation

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

Installation

pip install canonicalwebteam.views-from-yaml

Usage

E.g. create a YAML file:

And edit your Django app's urls.py:

# django_app/urls.py

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(
    yaml_filepath="url-settings.yaml",
    view_callback=url_view
)

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