Wagtail : An Open Source CMS.

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.