summaryrefslogtreecommitdiff
path: root/patchwork/settings
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2016-06-16 16:13:17 -0500
committerStephen Finucane <stephen.finucane@intel.com>2016-06-27 18:19:08 +0100
commit92b6e6a39595841782b967e34e9b3bdebefbf1ec (patch)
tree3846790c3aea7cf5f8c7e093cfd6c1942fa353af /patchwork/settings
parent6f283ef361bd58120a527b917a18d4207053f348 (diff)
downloadpatchwork-92b6e6a39595841782b967e34e9b3bdebefbf1ec.tar
patchwork-92b6e6a39595841782b967e34e9b3bdebefbf1ec.tar.gz
REST: Add base configuration hooks for a REST API
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@linaro.org> Inspired-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Stephen Finucane <stephen.finucane@intel.com>
Diffstat (limited to 'patchwork/settings')
-rw-r--r--patchwork/settings/base.py11
-rw-r--r--patchwork/settings/dev.py2
2 files changed, 13 insertions, 0 deletions
diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index 2f81d4b..14f3209 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -28,6 +28,14 @@ INSTALLED_APPS = [
'patchwork',
]
+try:
+ # django rest framework isn't a standard package in most distros, so
+ # don't make it compulsory
+ import rest_framework # NOQA
+ INSTALLED_APPS += ['rest_framework']
+except ImportError:
+ pass
+
# HTTP
MIDDLEWARE_CLASSES = [
@@ -148,6 +156,9 @@ NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL
# Set to True to enable the Patchwork XML-RPC interface
ENABLE_XMLRPC = False
+# Set to True to enable the Patchwork REST API
+ENABLE_REST_API = False
+
# Set to True to enable redirections or URLs from previous versions
# of patchwork
COMPAT_REDIR = True
diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
index 8cf0526..e5c88d2 100644
--- a/patchwork/settings/dev.py
+++ b/patchwork/settings/dev.py
@@ -86,3 +86,5 @@ if django.VERSION >= (1, 7):
#
ENABLE_XMLRPC = True
+
+ENABLE_REST_API = True