How to Build a Website and Blog with django CMS, Without Knowing Python/Django - Pt. 7
- Part 1: Setup
- Part 2: Building Our First Template
- Part 3: Adding Content
- Part 4: Getting to Know News & Blog
- Part 5: Fine-tuning the News & Blog Addon
- Part 6: Implementing a Contact Form
- Part 7: Setup Project Locally
- Part 8: Creating Your First Django Application
- Part 9: Creating Your First django CMS Plugin
Part 7: Setup Project Locally
This tutorial will guide you through the steps to create your first django CMS addon, which will allow you to extend CMS pages with custom fields and functionalities.
In this section, you will learn:
- How to setup the project on your local computer and use the Divio Command-Line Client (Divio CLI).
- How to use Divio Shell to setup and run the project locally.
- How to create a new custom addon for your project, which allows you to extend a CMS page with new fields and functionalities.
What is docker?
Docker is an open-source technology used to create encapsulated (application) environments inside a “container.” All containers use a shared operating system, which makes it more efficient than virtualising individual machines for each container. For Aldryn, this means we can provide you with the “container” of your actual website, including the same environments on NGINX, Postgres, Python libraries and so on.
Installing the Divio App
To download the latest version of the Aldryn Desktop App, please use the links below:
Open the file and install it on your system (on Windows by running “Divio.exe” and on OS X by moving “Divio.app” into your Applications folder).
When you launch the application for the first time, you’ll be asked to login with your credentials or the Access Token, which you can get from the Divio Control Panel.
Next, select your Project on the left side of the app and click "Setup".
This will start the Divio App wizard, which will help you to setup and install all missing dependencies (like generating SSH keys, installing Docker or Git).
It can take roughly 10 to 30 minutes, depending on your internet connectivity and computer performance.
The installation process requires you to enter your admin password for the dependencies to be installed. You might also encounter warning signs showing "Not working" > "Fix me". In this case just press "Fix me" and let the Divio App do the heavy lifting. If the installation process seems unresponsive, simply "Cancel" and restart again.
A terminal window might show up in addition to confirm your RSA (SSH key) footprint. Simply type in "yes" and wait for the window to setup your project. If that process fails, close the window and click on "Setup" again.
The Divio App will showcase the progress of the Setup on the top of the user interface. This and the "Start" button will change once the process has finished.
It might take multiple times if you setup your computer for the first time.
Problems with SSH
You might encounter connections problem resulting in warnings about entering a passphrase. This can occur if you have setup an SSH key already for a different project or account. You can solve this by deleting your current SSH key (~/.ssh directory) and recreating one. Follow the steps on GitHub about Generating a new SSH key and be sure to use the Aldryn account email.
If you run into any problems during the installation, a reboot will often help solve temporary issues. However, if that doesn’t help with the issue, please don’t hesitate to contact us or visit our chat at https://www.divio.com/chat/academy.
Setup and Run Your Project Locally
Now that we have everything setup on our computer, let’s get our project to run locally. Select your project (use the search box if you can’t find it) and click on "Start".
This will start the server and allow you to open your website by clicking on the "eye" icon on the right of "Local Server". A browser window will open where you are prompted to login to django CMS.
If your local server is located at http://192.168.99.100:8000/, the URL would become http://192.168.99.100:8000/?edit. Click on “Add user” and create a new account for yourself (make sure you tick the checkbox “Is superuser”). Now click on “Create” and select the newly created user from the drop-down, before confirming with “Sign in.”