Dockerising wagtail projects in 5 minutes - Sævar Öfjörð Magnússon

This video features Sævar Öfjörð Magnússon at Wagtail Space NL 2022 in Arnhem, Netherlands.

Dockerising wagtail projects in 5 minutes - Sævar Öfjörð Magnússon
0:04:08
Published June 30, 2022
93 views

Summary

Sævar Öfjörð Magnússon explains how he built a template repository for starting Wagtail projects entirely in Docker. Wanting to keep his host computer free of Python and other project dependencies left him unable to create a normal project locally, so the template provides a Docker container in which he can create one. He clones the template, starts the container, opens a shell with `docker compose exec`, runs `wagtail start` and `manage.py migrate`, then restarts the container with the project’s normal process. The setup also lets users customize the port to avoid conflicts and leaves initial project creation under their control.

Key takeaways

  • A template repository can bootstrap a Wagtail project without installing Python dependencies on the host computer.
  • Start the Docker container, open a shell with `docker compose exec`, and run `wagtail start` to create the project.
  • Run `manage.py migrate`, then restart the container using the project’s intended process.
  • Customize the exposed port when other Docker containers cause conflicts.
  • The template leaves project naming and initial setup choices to the developer.

Summarised automatically from the transcript.

Questions this talk answers

Why develop a Wagtail project inside Docker?

Docker lets you keep the host computer clean instead of installing and maintaining Python and project libraries on it. The speaker adopted this approach for client projects and wanted a reusable template to create projects without host dependencies.

Discussed at 0:02

How do I create a new Dockerized Wagtail project from a template?

Create a repository from the template and clone it, then start the containers with `docker compose up`. Use `docker compose exec` to open a shell, run `wagtail start` in the project folder and apply migrations; then restart the container with the project’s normal process.

Discussed at 1:36

Open full transcript Markdown

Transcript

460 words · auto-generated · en Show transcript

Automatically transcribed, so expect mistakes in names and technical terms.

Originally I wanted to do a talk about how I would dock raise a an existing Wagtail project. The backstory is that like in January I got a new computer and we decided to move everything we had for clients. To Docker. So I want to maintain like a clean host computer without any libraries or Python stuff in it so I only use Docker to develop locally. So it turns out that I don't have an existing project on my computer like I couldn't create a base project on my computer because I don't have any of the dependencies.

So it was a kind of a cat's twenty two. So I flipped it so I will show you how I created a small template repository which will allow you to create a Docker Doc Rest Wagtail project in you know a few minutes. But first, this is a mess mistake many rookies do. They don't have the proper attire when working with docs. So you know. Okay, now I'm ready. Yeah, so I created a small template repository which you can use to

generate a product project. So I'm going to use this template I'm going to create a my Wagtail site. That's available. Create the repository from template So now I have the repository. I can clone the repository locally. So I will open up a terminal. Can you see this? No. Yeah. Okay. So I'll go to something like Code git clone repository. So what I would do here is just Docker compose

up Port already all located. Yeah, okay. So yeah, I run a lot of Dockers and some Sometimes they conflict. So I have this thing where I can customize the port. So what I do initially is I let the container run in kind of an infinite loop really. It's not doing anything at the moment because when you have an empty container, I didn't want to go the path of like doing everything for you in the beginning.

Because you want to control perhaps the name of your project and stuff like that. So I would just do a Docker compose exec Go into a shell and do a wagtail start my site in the current folder. I will I can do a manage migrate. So now I'm gonna stop the container again I'm going to switch it over to the correct process Run it again.

So here it is. Thank you.

Conference

Wagtail Space NL

June 15 - 17, 2022

Arnhem, Netherlands

Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.

More videos by Sævar Öfjörð Magnússon

More videos from Wagtail Space NL