Wagtail CMS (content management system) is a simple and agile Django-powered CMS, which offers a convenient and intuitive interface for editors to create and structure website content. Wagtail is published under the BSD license, which provides you as much freedom as possible. The exceptional performance and optimization of this CMS ensure lightning-fast page loading and searches. With the advantages of Wagtail, you can spend less time on configuring your site and more on perfecting your project (using a vast number of tools in the administration panel for working with content).
This article describes how to deploy Wagtail CMS into your Jelastic Python environment.
Create Python Environment
To start with, you need to create an environment with the appropriate application server – the Apache web server with the Python engine.
1. To create New Environment, log into your Jelastic dashboard and click the same-named button at the top-left corner.
2. In the opened topology wizard, switch to the Python tab and choose the required Python version for the automatically selected Apache application server node.
Note: The latest Wagtail CMS versions support the Python 3.x only. On the Python 2.7 instances, run the 1.13 version of the application.
Configure all other settings up to your need (e.g. cloudlet limit, disk space, region, etc), set the desired domain name and click the Create button.
3. Wait a minute for your environment to be created.
Now, you are ready to start the Wagtail CMS application deployment. Below, we’ll overview how to deploy it automatically using the pre-packaged archive and manually from scratch.
Wagtail CMS Automatic Deployment
We’ve prepared a deployment archive with already configured Wagtail CMS of the latest version available at the moment (i.e. 2.2) and SQLite database, which can be installed in a matter of minutes without any manual configurations required.
Note: If configuring own deployment archive, please ensureyour Wagtail CMS package contains the following files in its root:
requirements.txt file with the names of all the Python modules your application requires, it will be read by the deployment script to install the listed modules via the pip manager automatically
wsgi.py file with the entry point script for running your application inside a virtual environment by means of the mod_wsgi for Apache
1. Upload the package with your Wagtail CMS application into your deployment manager via the following link:
3. After the operation is finished, select the Open in Browser button next to your environment.
4. That’s all! Now you can enjoy working with your Wagtail CMS application (the default credentials for the admin panel are – admin / verysecurepasswordforadmin).
Enjoy your Wagtail CMS hosted at Jelastic PaaS!
Wagtail CMS Manual Deployment
For the manual Wagtail CMS application deployment, we’ve divided the process into three major steps: application installation, database configuration and running Wagtail CMS.
Install Wagtail CMS
1. Access your Apache application server via SSH. For example, we’ll utilize the inbuilt Web SSH tool.
2. It is a common practice to run Python web applications in isolated virtual environments, using the virtual environment tool. It allows keeping the dependencies required by different projects in separate places and manage them without the administrator privileges.
So, perform the following to create and activate a new virtual environment:
3. Now, download the Wagtail CMS installer using the pip package manager for Python:
pip install wagtail
Note: If running the Python 2.7 instance, you need to specify the appropriate application version in your command explicitly, i.e. pip install wagtail==1.13.
4. We are going to install the application to the ROOT context, so the existing folder (with the default application) should be removed beforehand:
rm -rf ROOT
wagtail start ROOT
Next, you need to choose and configure a database.
As all the Django-based applications, Wagtail CMS supports different types of databases:
SQLite is a default option, which does not require any additional configurations (data will be stored locally in ~/ROOT/db.sqlite3); being fast, simple and light-weight, it is great for development and testing purposes
external database (e.g. MySQL or PostgreSQL) is a more suitable solution for the production environment; it ensures a sufficient level of security and scalability
Below, we’ll provide a step-by-step guide on connecting the external database to your Wagtail CMS application. Herewith, if the first option is sufficient for your purposes, skip this section and proceed to the next Run Wagtail CMS one.
1. Create the desired database instance. For example, use the Change Environment Topology button to add the MariaDB server to your environment with the Wagtail CMS installed.
2. Open the database admin panel and log in with credentials from the appropriate email (automatically sent after DB node creation).
3. Navigate to the User accounts tab to create a user for accessing the Wagtail CMS database by clicking the Add user account link.
4. Within the opened frame, specify the User name/Password and tick the Create database with same name and grant all privileges checkbox.
Click Go at the bottom of the page.
5. Return to the dashboard and open the /var/www/webroot/ROOT/ROOT/settings/base.py file. Locate the DATABASES section and add DB access credentials within the same section (as it is shown below):