Here’s what you’ll have after completing this guide:

This guide will help get you started. We'll take you through key steps, introduce you to important concept and point you to further documentation and other resources along the way. It's not intended to be a complete tutorial, and you will need to be prepared to look further into some topics on your own if necessary. 

A plain-text code editor to work on the code and configuration is required. Atom, Sublime and Visual Studio are all excellent choices.


About Python

Python is a high-level general-purpose programming language that has proved itself suited to a vast range of applications. It has a design philosophy that emphasises code readability.

Before we begin

Before we create a project, please familiarise yourself with the basics of Divio Cloud. Some key topics and resources:

Some of these guides will make more sense and be most useful once you have already dived in and are working with Divio Cloud.

Create a new project

Create a new project with the following configuration:

  • Platform: Python 3.6.x
  • Type: Django
  • Boilerplate: Default

Then select a suitable subscription and create the project.

Why are we installing Django?

Our Django project types give you a fully-configured Python environment, so you don't have to do it yourself. You don't need to use Django itself in the project. 

Set up the project locally

You will need to be aware of some key topics as we continue - refer to these articles if necessary as you go along:

Once you have installed and launched the Divio App on your computer, set up the the project you just created by clicking Setup:

This will take a few minutes to conclude. Once completed hit Divio Shell on the lower left of the Divio App.

Not working? Retrace your steps, and pay close attention to any error messages, as they will contain important information about the problem. You will also find valuable guidance in the material recommended above.


About Docker

Divio Cloud uses Docker to run your projects locally. This allows you to use any programming language – be it Python, Node or PHP – locally, without configuring your operating system to support it. If you are experience issues, have a look at our troubleshooting section or our Docker guide.

Preparing for the Python tutorial

Before you can start the Learn Python the Hard Way tutorial, we need to do a few more things:

Code editor

When prompted to open the source folder in a code editor: You'll find it by selecting the "folder" icon in the Divio App and opening the whole directory in your editor:

Using a shell

You will need to run commands in a command line environment. The Divio App makes this easy for you - just click on the Divio Shell button on the lower left of the app. This will create a terminal shell with all the necessary environment variables in place.

Everything should show up with green checks - if not trace your steps back to resolve it.


About shell commands

You should be familiar with basic shell commands such as cd , open and cp as they are essential items in the developer's toolbox. The Learn Python the Hard Way tutorial has a very good appendix introducing these commands.

Entering commands

The tutorial will ask you to run specific commands such as:

  • python --version 
  • python; quit();
  • python 

You will need to run these inside the Docker container of your project, not in your own environment on your computer. To get into the container, run the following command in the Divio Shell:

  • docker-compose run --rm web bash 

Don't forget to cd to into the project folder first.

Divio Cloud

Divio Cloud is built around deployment needs, and provides features such as a database, Git repository, web services and more. You don't need all this to learn plain Python. However, if building applications is your goal, our system allows you to get started in a self-contained application-oriented environment that's built around collaboration and deployment.


About Git

Git is a version control system (VCS) and tracks the history of your changes as people and teams collaborate together on a project. It is very helpful to be familiar with Git and what it does. An excellent starting point is the very popular Git tutorial on GitHub.

Start the Python tutorial

Now head over to Learn Python the Hard Way and start your journey as a Python developer. 

You can skip ahead to Exercise 1: A Good First Program. From there your journey to learning Python begins.

Some remarks

  1. You can still read the first two chapters until A Good First Program. They help you to understand what's necessary to set up Python. However, there are no actions needed as Divio optimises the setup automatically for you.
  2. There are additional folders visible in your project. Ignore these and recommend adding a single folder where you add your exercise files. The tutorial recommends mkdir lpthw .
  3. Learn Python the Hard Way is free until exercise 8, if you want to continue with an alternative free course, have a look at
Did this answer your question?