[PATCH v3 02/10] REST: Add base configuration hooks for a REST API

Finucane, Stephen stephen.finucane at intel.com
Thu May 19 16:46:43 AEST 2016


On 18 May 22:30, Andy Doan wrote:
> This adds the ability to expose a REST API based on the Django REST
> framework project. Since this project isn't packaged in most current
> distributions, we ensure that its both installed and enabled before
> trying to use it.
> 
> Signed-off-by: Andy Doan <andy.doan at linaro.org>
> Inspired-by: Damien Lespiau <damien.lespiau at intel.com>
> Reviewed-by: Stephen Finucane <stephen.finucane at intel.com>

Reviewed-by still valid and suggestion for future work below.

Stephen

> +if settings.ENABLE_REST_API:
> +    if 'rest_framework' not in settings.INSTALLED_APPS:
> +        raise RuntimeError(
> +            'djangorestframework must be installed to enable the REST API.')
> +    import patchwork.views.rest_api
> +    urlpatterns += [
> +        url(r'^api/1.0/', include(patchwork.views.rest_api.router.urls)),
> +    ]

Future work item: alias 'api' to the latest version ('api/1.0', at the
moment)?


More information about the Patchwork mailing list