How to Install Wagtail CMS using Pipenv in Less Than 6 Minutes

This video is from Wagtail CMS 2023 .

How to Install Wagtail CMS using Pipenv in Less Than 6 Minutes
0:06:01
Published November 29, 2023
82,895 views

Installation instructions:
pip3 install wagtail
wagtail start mysite
cd mysite
pipenv shell
pip3 install -r requirements.txt
python3 manage.py migrate
python3 manage.py createsuperuser
python3 manage.py runserver

Full Article:
https://learnwagtail.com/tutorials/how-to-install-wagtail-using-pipenv-less-6-minutes/

Learn Wagtail from scratch with the official Wagtail for Beginners Course
https://learnwagtail.com/wagtail-for-beginners/

Used in this video: Wagtail 2.4, Python 3.7, Django 2.1.5 #Wagtail #Django #Python

Summary

The installation uses Wagtail’s documented project setup, beginning with checking the Python and Wagtail installation, creating a project with `wagtail start`, and entering its directory. The speaker then creates a Pipenv environment, installs the generated requirements, runs Django migrations, creates a superuser, and starts the development server. The new site is available at `localhost:8000`, with the Wagtail admin at `/admin`, where the newly created user can log in.

Key takeaways

  • Check the Python version and install Wagtail before creating the project.
  • Use `wagtail start mysite` to generate a new Wagtail project directory.
  • Run `pipenv shell` and install the project dependencies from `requirements.txt`.
  • Run `python3 manage.py migrate` to set up the project database.
  • Create a superuser, then use `python3 manage.py runserver` to access the site at `localhost:8000` and the admin at `/admin`.

Summarised automatically from the transcript.

Transcript

961 words · auto-generated Show

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

0:00

Hello and welcome to the first lesson on building a Wagtail website. In this video we're going to install Wagtail using PipEnv. Now the first thing you're going to want to do is you're going to want to go to Wagtail. io and they actually have install instructions. And these instructions are so perfect that we don't actually need to do anything else except follow these seven steps. So here we have Try Wagtail and Seven Lines, and this is exactly what we're going to follow. I'm going to show you exactly how I do it. And so I've just got my terminal here and I want to make sure that we're all on the same page here. So I'm going to type pip dash V And you will see that I'm using Python 3. 7. Now you can use Python 35 or 36. I just got the latest Python, so no big deal there

0:47

First we actually need to make sure that Wagtail is installed, so we do pip installwagtail. There we go, Wagtail's installed. Now, just to double check, we can do it a pip freeze, pipe, grep, and then type Wagtail And we have Wagtail 2. 4 currently installed on our computer. Now this is not inside of a pipenv or virtual env or anything. This is actually on my computer. Now to get a Wagtail site set up, all we have to do is type Wagtail Start MySite. But I'm going to go into a directory where I want to keep all of my websites. So if I CD into websites, I just made a folder called websites, and then I can type

1:33

Wagtail start my site. My site is the name of the website. So if you have a custom blog or a custom name for your website, use that name. Don't use my site. But for this demo, we're going to use the uh the name my site And look at that project has been created. So let's do an LS-LA. And I can see that there's a folder in there called my site. So I cd into that Ls dash La and I've got a bunch of files in there. If I had a Docker file, home MySite Search Requirements and Manage. py. Cool. So at this point what we don't see in the instructions is How to use a pipenv or virtual env or installing with Docker.

2:18

So in this lesson we're going to be using pipenv and we're actually going to type pip env shell and that just creates a new pip environment for us. And now we can see if we look over Here we can see that we are in some sort of environment. Now this is good for Separating your Python packages from your system so that you can have multiple projects going on at the same time and you're not going to get package conflicts or dependency conflicts with different package or dependency versions. Now we run pip

3:04

install in stall dash r requirements. txt and we just let that run Alright, so through the power of editing, you actually didn't see all of that get downloaded, but you should have seen a bunch of stuff show up in your terminal. So assuming everything went well there, you have Wagtail 2. 4 installed or whatever the most current version is, and then all we have to do is run some migration. So we run python3 manage. py migrate And this will set up your local database with this project. So you can see it's running a bunch of migrations already. Everything looks good there. Next we need to create a super user. And this super user is how you actually get into your admin section

3:50

because If you've ever used a content management system, you know that you can't get into your management system. You can't log in without some sort of username and password. So we're going to type python3 manage. py create superuser It's gonna ask me if I want to use a name. I'll just use Caleb. Caleb at Learnwagtail. com password just some password another localhost password Super user created successfully. Cool. So we've now run migrations. Our database is set up. We have a new user in there. Let's run the server and actually get this thing set up. so that we can see it in our browser. So we do python3

4:35

manage. py run server and that is it Assuming that I could type manage properly, there we go. So in here we can see using Django version 2. 15, and I'll show that to you in here I'll highlight that 2. 15 using settings, mysite. settings. dev. So this is our development environment. Starting development at 127. 0. 0. 1. This is the equivalent of localhost. on port 8000. So let's open this up in a browser. And all I'm going to do is create a new tab, go to localhost port 8000, and voila, we have a brand new Wagtail site. Now this is technically The entire video you have Wagtail set up and running.

5:21

Now if you want to get into your admin interface, you can click the link at the bottom right where it says admin interface or just go to localhost port 8000 slash Admin. Type in the username that you made. I'm gonna type in mine. And voila, we are inside of Wagtail. Now just like that, we are set up and up and running with a new install of Wagtail CMS using a pip environment. If you like this video and you're interested in learning other things from Wagtail, always check out Wagtail. io, they have great docs. Or head on over to learnwagtail. com

Questions this talk answers

How do I install Wagtail and create a new Wagtail project?

Install Wagtail with `pip install wagtail`, then move into your websites directory and run `wagtail start mysite` (replacing `mysite` with your project name).

Discussed at 0:47

How do I set up a Wagtail project with Pipenv?

From the new project directory, run `pipenv shell` to create and enter an isolated environment, then install the project dependencies with `pip install -r requirements.txt`.

Discussed at 2:18

How do I initialize the database for a Wagtail site?

Run `python3 manage.py migrate` to apply the migrations and set up the project's local database.

Discussed at 3:04

How do I create a Wagtail admin user?

Run `python3 manage.py createsuperuser` and follow the prompts to choose a username, email address, and password.

Discussed at 3:50

How do I run a Wagtail site locally and log into the admin?

Start the development server with `python3 manage.py runserver`, visit `localhost:8000`, and use `localhost:8000/admin` or the Admin interface link to log in with the superuser account.

Discussed at 4:35

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 from Wagtail CMS