1. Create a new Wagtail Django application#
In this section we will create and deploy a new application in the Divio Control Panel using Wagtail, a very popular Django-based content management system framework. The principles covered by the tutorial will apply to any other development stack.
You could equally well create a plain Django application, and install Wagtail in that. However, the Wagtail application type saves some time by setting up a ready-to-go application, with Wagtail automatically installed and configured.
This tutorial assumes some basic familiarity with Wagtail. It is intended to introduce the basics of working with the Aldryn Django framework on Divio, using Wagtail as an example. It is not a tutorial for learning Wagtail (or Django).
We also provide tutorials to get started with Django
If you have not already done so, you will need to set up the local development environment.
1.1.1. Create the application#
In the Divio Control Panel, create a new application.
Any web application in any language can run on Divio, as long as there is nothing that prevents its being Dockerised. For convenience we provide some ready-to-go application types for applications built in Java, PHP, Node and other languages. Use of these is optional. You can also start with a Build your own application, in which you build your application from a blank sheet.
For this tutorial, select the following options for your application (other options should be left on their default settings):
At the time of writing, the latest default version Aldryn Wagtail addon uses Wagtail 2.14.1 - others are also available.
Divio Applications use Git for code management. We provide a Git server that your Applications will use by default; you can also choose to use another Git service if you prefer. For this tutorial, use our Git server.
Hit Continue, then select the free Developer plan for this Application (the Developer plan is fully-featured and provides all you need to work on an application up to the point of putting it into production).
It takes a few moments to create the Application. During this process, the Control Panel defines the basic Application files for your application by adding commits to its repository. This could include assembling its Dockerfile and other files, depending on the Application type.
1.1.2. Application environments#
Your Application has two independent server environments, Test and Live . The Test and Live environments have their own services, and unique environment variables to configure access to them. They can be deployed independently, and can also be configured to track different Git branches.
1.1.3. Deploy the application#
Once the application has been fully created, use the Deploy button to deploy the Test server.
The deployment process first builds the Docker image from the
Dockerfile, and then launches a Docker container from
the image. The container environment will include automatically-configured environment variables for connections to
services such as the database, media storage and so on.
Typically, this takes a minute or so.
1.1.4. Open the Test environment website#
Once you have successfully deployed the Test environment, the Control Panel will indicate this in the interface with a
Last deployment successful at … message and the application URL in the Test environment pane will display as a link,
https://tutorial-project-stage.us.aldryn.io. Select the link to access the application.
Since this is your own application, you can use our single-sign-on to log in by selecting Log in with Divio. You’ll see the “Welcome to Wagtail” page.
More interesting are the admin pages:
the Wagtail admin, at
/admin, shown below
the Django admin, at
1.2. About deployment#
Divio requires a payment card verification as one of the counter measures against abusers. Go to the organisation settings of your application, select billing and complete the payment method to be able to deploy. The verification process won’t charge your card. Refer to why Divio requires payment card verification for more details.
Any time new changes to the application code are committed to its repository, the Control Panel will indicate this with a message showing the number of undeployed commits for each of its server environments.
New code and configuration changes applied via the Control Panel (to subscriptions, cron jobs, environment variable, domains or other settings) will not take effect on either server environment until it is deployed once again.
If for whatever reason a deployment fails, there will be no down-time - the containers that are currently running will continue running, and the failing changes will not be deployed.
1.3. Explore the Dashboard#
The Divio application Dashboard provides you with access to useful controls and information for the application. They are fairly self-explanatory and at this stage you don’t need to interact with any of them, but it’s worth familiarising yourself with what’s available.
1.3.1. Enable Beta options#
We often expose new functionality to users who opt-in to Beta features. You can do this in your account settings.