Wagtail : An Open Source CMS.

Ajay Kumar
Aug 15, 2018 · 3 min read
Wagtail

Wagtail is a free and open source Content Management System (CMS) written in Python. It is popular amongst CMSes using the Django framework. The project is maintained by a team of open-source contributors backed by companies around the world.

Let’s make an Wagtail site .

1. Install Wagtail and its dependencies:

pip install wagtail

2. Create your new Project:

wagtail start mysite
cd mysite

3. Install project dependencies:

pip install -r requirements.txt

4. Create the database and an admin user :

python manage.py migrate
python manage.py createsuperuser

5. Run the Project :

python manage.py runserver

If everything worked, http://127.0.0.1:8000 will show you a welcome page

You can now access the administrative area at http://127.0.0.1:8000/admin

Admin Login
Admin Dashboard

Extend the HomePage model

Edit home/models.py as follows, to add a body field to the model:

from django.db import models

from wagtail.core.models import Page
from wagtail.core.fields import RichTextField
from wagtail.admin.edit_handlers import FieldPanel


class HomePage(Page):
body = RichTextField(blank=True)

content_panels = Page.content_panels + [
FieldPanel('body', classname="full"),
]

Run python manage.py makemigrations, then python manage.py migrate to update the database with your model changes. You must run the above commands each time you make changes to the model definition.

Edit home/templates/home/home_page.html to contain the following:

{% extends "base.html" %}

{% load wagtailcore_tags %}

{% block body_class %}template-homepage{% endblock %}

{% block content %}
{{ page.body|richtext }}
{% endblock %}

Note: You’ll need to include {% load wagtailcore_tags %} in each template that uses Wagtail’s tags. Django will throw a TemplateSyntaxError if the tags aren’t loaded.

Edit Home Page

Wagtail provides a number of template tags & filters which can be loaded by including {% load wagtailcore_tags %} at the top of your template file.

nonstopio

Software Product Development as a Service

Ajay Kumar

Written by

nonstopio

nonstopio

Software Product Development as a Service

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade