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 applications, so that you can run them on your own computer, and interact with the Divio Control Panel and the same applications 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 your browser at https://control.divio.com/account/desktop-app/access-token/, where you can copy an access token to paste into the prompt. The access token is hidden for security reasons.

(Windows users: if your divio login fails with an invalid token, check the note for Windows users.)

Add your public key to the Control Panel#

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

Usage#

The Divio CLI allows you to interact with applications both locally and in the Cloud. For example, to set up a Cloud application locally:

divio app setup <application slug>

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

divio app pull db
divio app push media

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

divio app push db live

or even another application:

divio app pull db --remote-id

Similarly, you can do things like view runtime logs:

divio app logs --tail live

or open the application dashboard:

divio app dashboard

or associate a local application with a cloud application:

divio app configure

and to manage environment variables:

divio app environment-variables

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.