Skip to content
Permalink
Browse files

Enabling Wagtail v2 API (Headless CMS)

  • Loading branch information
KalobTaulien committed Mar 19, 2019
1 parent f942392 commit 8988bd85cc88e6fb58e36ab4a2632b4358ae5fc4
Showing with 16 additions and 0 deletions.
  1. +10 −0 mysite/api.py
  2. +2 −0 mysite/settings/base.py
  3. +4 −0 mysite/urls.py
@@ -0,0 +1,10 @@
from wagtail.api.v2.endpoints import PagesAPIEndpoint
from wagtail.api.v2.router import WagtailAPIRouter
from wagtail.images.api.v2.endpoints import ImagesAPIEndpoint
from wagtail.documents.api.v2.endpoints import DocumentsAPIEndpoint

api_router = WagtailAPIRouter('wagtailapi')

api_router.register_endpoint('pages', PagesAPIEndpoint)
api_router.register_endpoint('images', ImagesAPIEndpoint)
api_router.register_endpoint('documents', DocumentsAPIEndpoint)
@@ -49,6 +49,7 @@
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail.api.v2',

'modelcluster',
'taggit',
@@ -63,6 +64,7 @@

'captcha',
'wagtailcaptcha',
'rest_framework',
]

MIDDLEWARE = [
@@ -10,6 +10,8 @@

from search import views as search_views

from .api import api_router


urlpatterns = [
url(r'^django-admin/', admin.site.urls),
@@ -19,6 +21,8 @@

url(r'^search/$', search_views.search, name='search'),

url(r'^api/v2/', api_router.urls),

url(r'^sitemap.xml$', sitemap),
# For anything not caught by a more specific rule above, hand over to
# Wagtail's page serving mechanism. This should be the last pattern in

1 comment on commit 8988bd8

@KalobTaulien

This comment has been minimized.

Please sign in to comment.
You can’t perform that action at this time.