Skip to content
This repository has been archived by the owner on Oct 8, 2018. It is now read-only.

canonical-web-and-design/views-from-yaml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated

This module has been moved into [canonicalwebteam.yaml-responses](https://github.com/canonical-webteam/yaml-responses), and will no longer be maintained. You should now import the relevant functions from that module instead.

---

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!".

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages