How to set up the Divio local development environment

This document guides you through the installation and basic configuration of components required to set up a working local environment for Divio projects, so that you can run them on your own computer, and interact with the Divio Control Panel and the same projects deployed on our cloud infrastructure.

See also

This document assumes you are a reasonably experienced software developer. If you are completely new to Divio and the tools mentioned here, please see our tutorial, which guides you through the process in more detail.

Pre-requisites

In order to use the Divio CLI, you will need to install various packages if you do not already have them installed, including:

  • Docker

  • Git

  • Pip

Install the CLI

The Divio CLI is a Python application. Note that it requires Python 3.6 or higher. Install it with:

pip install divio-cli

Log in using the CLI

Run:

divio login

This will open https://control.divio.com/account/desktop-app/access-token/ in your browser, from where you can copy a token to paste into the terminal.

Add your public key to the Control Panel

Upload your public key at https://control.divio.com/account/ssh-keys/.

Usage

The CLI allows you to interact with projects locally and on the Cloud; for example, to set up a Cloud project locally:

divio project setup <project slug>

Commonly used commands include those to push and pull database and media, for example:

divio project pull db

divio project push media

Where appropriate, you can specify a particular environment (default is always Test):

divio project push db live

or even another project:

divio project pull db --remote-id

Similarly, you can do things like view runtime logs:

divio project logs --tail live

or open the project dashboard:

divio project dashboard

or associate a local project with a cloud project:

divio project configure

and to manage environment variables:

divio project env-vars

See the reference guide for full details of commands and options.

Next steps for new users

If you have a basic familiarity with Docker and cloud deployment, we recommend you follow the How to configure an existing Django application for deployment on Divio guide for a concise, practical walk-through the process of configuring an application for local development and deployment to our cloud infrastructure.

If Docker, containerisation and cloud deployment are new to you, we recommend that you work through our detailed, beginner-oriented tutorial, which is designed to introduce all the concepts and tools you require in order to use our platform successfully.