Wagtail is a Python-based CMS made for Django. The Wagtail CMS was released in 2015 by a digital agency named Torchbox, the same agency that created South migrations for Django in 2008. So when we encountered a project that required a content management system, we had an additional reason to give Wagtail CMS a try. We decided to try it out in practice.

Explanation to Wagtail Python CMS

Compared to other famous content management systems like Django Content Management System, which provides a ton of flexibility to the administrator (content manager) at the cost of interface complexity, the Wagtail CMS has a rather simple interface with minimum settings. And all of these settings and functionality have to be implemented in code. Content managers can only use a set of tools that are implemented programmatically as Python classes or so-called blocks.

  • Wagtail provides a lightweight and straightforward interface
  • In Wagtail as all querying and database use can be fully controlled by the developer.
  • Wagtail provides Ease and speed of development because Wagtail is Django and uses Django’s authentication backend, templating system, and so on.

Why We use Wagtail

We use Wagtail for the CMS (content management system) in the Django rest framework. Because for cms, we need to create templates for every API but

Wagtail provides its admin with a frontend interface. We connect Django rest APIs to the wagtail framework with wagtail models.


Installation and setup

For Django, we install Wagtail through pip

$ pip install wagtail

After installing Wagtail, we setup configuration in the settings.py file in installed apps:


Add wagtail Site name in settings.py. This will be displayed on the main dashboard of the Wagtail admin backend:-

Configuration URL

We configure urls.py in our project directory with the wagtail URLs


wagtailadmin_urls provides the admin interface for Wagtail. This is separate from the Django admin interface:-

Admin Interface for Wagtail CMS

Login admin in Wagtail

In the Wagtail CMS, pages are Django models. Pages inherit from the abstract Wagtail Page model, which has all the service methods, fields, and properties needed by a page. We use Rich Text Field in our Django ems project, so we implement wagtail models:-


In EMS projects, we use different — 2 Wagtail models for many purposes like: for birthday (BirthdayPage Model), upcoming holiday (UpcomingHoliday Model), etc. We’ve used a standard Django CharField in these models and a field from the Wagtail CMS called RichTextField.

To be able to preview our new page, we need to create a template for it. A template file must be placed either in the project’s templates directory (under the blog subdirectory) or inside the application templates directory. It must be named exactly like in the model.

The page will automatically be registered in the admin interface, so all left is to create and apply a migration.

For example, we open a birthday page this looks like this, and we fill in all the details on this page. We can view all data in Django, admin form wagtail admin.

Django-admin View of pages:

Here wagtail data is showing in the Django-admin table

Difference between Django CMS and Wagtail

Django-cms and Wagtail are both based on the Django framework. It is very similar to the classic Django-admin page. The Django CMS admin style overrides Django admin’s base_site.html, but you can still partially customize this page.

Django-CMS might use the Django admin as its admin page; it creates custom templates to make the page look more decent. But this implementation also brings some problems. If your existing application, which has an existing admin app, wants to integrate Django-CMS to add some CMS functions, Django-CMS might not work very well in this scenario.

Django-CMS is not more flexible than Wagtail because, in Wagtail, we easily extend the model and integrate CMS into your existing project.

You May Also Like