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.

Transcript

460 words · auto-generated Show

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

0:02

Uh uh originally I wanted to do a talk about how I would uh dock raise a uh an existing Wagtail project. Uh the backstory is that uh like in January I got a new computer and we decided to uh move everything we had for clients. Uh uh to Docker. So uh I want to maintain like a clean uh host computer without any uh 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 uh I don't have any of the dependencies.

0:49

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

1:36

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 uh clone the repository locally. So I will open up a terminal. Uh can you see this? No. Yeah. Okay. So I'll go to something like uh Code git clone repository. So what I would do here is just uh Docker compose

2:21

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

3:07

Because you want to control perhaps uh 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 uh start my site in the current folder. Uh I will I can do a manage migrate. Um so now I'm gonna stop the container again I'm going to switch it over to the correct correct uh process Run it again.

3:58

So here it is. Thank you.

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

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