---
title: "How to install Django CMS on your Cloud Web hosting"
url: https://docs.ovhcloud.com/de/guides/web-cloud/web-hosting/install-django-cms-on-cloud-web
lang: de
lastUpdated: 2022-05-04
---
# How to install Django CMS on your Cloud Web hosting

## Objective

Django CMS is a content management system (CMS) written in Python and based on the Django web framework.

[OVHcloud Cloud Web hosting](https://www.ovhcloud.com/de/web-hosting/cloud-web-offer/) lets you use Python as a runtime for your websites. You can therefore install and host Django CMS on it, as well as any other web application designed in this language.

In this tutorial, we will install a website with Django CMS on an OVHcloud Cloud Web hosting plan. We will then make it available behind your domain name.

## Requirements

- An [OVHcloud Cloud Web hosting plan](https://www.ovhcloud.com/de/web-hosting/cloud-web-offer/).
- Being logged in to your <ManagerLink to="/">Control Panel</ManagerLink>, in the `Web Cloud` section.
- What you need to know:
  - The basics of the Python ecosystem.
  - How to connect via SSH.
  - How to edit a file from the command line, using Vim, Emacs or Nano for example.

## Instructions

### Step 1: enable Python as a runtime

To access the runtimes of your Cloud Web hosting, log in to your OVHcloud Control Panel
. Click `Hostings`
 in the services bar on the left, then choose the name of the relevant Cloud Web hosting. Finally, go to the `Runtimes`
 tab.
The table that appears displays the runtimes currently added. Make sure that the Python runtime is enabled. If so, proceed to Step 2: [“Associate Python with a multisite”](#step-2-associate-python-with-a-multisite).

![django-cloud-web](/images/assets/screens/control-panel/product-selection/web-cloud/cloud-web/runtime-software-application/tab-python3.png)

If it is not, add a new one (if your plan allows it) or modify the existing runtime.

- **If you want to add a runtime**: click `Actions` above the table, then `Add a runtime`.
- **If you want to modify a runtime**: click the `...` button to the right of the relevant runtime, then `Modify`.

In the window that appears, fill in the requested information with the following values from our example, or adapt them to your situation.

| Information                  | Value to enter |
| :--------------------------- | :------------- |
| Custom name                  | Python 3       |
| Runtime                      | python-3       |
| Path to the public directory | public         |
| Application environment      | production     |
| Application launch script    | server.py      |

Once the information is filled in, click `Confirm`. If you want more information about managing runtimes, refer to our guide [“Managing Cloud Web runtimes”](/de/guides/web-cloud/web-hosting/manage-runtime-software-applications.md).

![django-cloud-web](/images/assets/screens/control-panel/product-selection/web-cloud/cloud-web/runtime-software-application/modify-a-runtime-software-application-python3.png)

### Step 2: associate Python with a multisite

Now that Python is enabled as a runtime, you need to associate it with one of your multisites. To do this, go to the `Multisite` tab. The table that appears contains all the domain names that have been added as a multisite.

![django-cloud-web](/images/assets/screens/control-panel/product-selection/web-cloud/cloud-web/multisite/tab-python3-full-disabled.png)

Two columns in the table above deserve your attention. Check that the Python runtime is properly linked to the relevant domains and that the root folder is correct; use the information below if necessary. If so, proceed to Step 3: [“Connect to your Cloud Web via SSH”](#step-3-connect-to-your-cloud-web-via-ssh).

| Column      | Description                                                                                                                                                                                                               |
| :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Root folder | This is the root folder that must contain the source code of the relevant domain (it corresponds to the “DocumentRoot”). In our example, we choose to specify “django”. It must therefore contain our Python source code. |
| Runtime     | This is the runtime associated with the relevant domain. The name displayed corresponds to the “Custom name” you defined when creating the runtime. In our example, you should find “Python 3”.                           |

If it is not, add a new multisite or modify the existing one.

- If you want to add a multisite\*\*: click `Add a domain or subdomain` to the right of the table.
- If you want to modify a multisite\*\*: click the `...` button to the right of the relevant domain name, then `Modify`.

In the window that appears, fill in the requested information according to your own situation. The table below shows the values used for this tutorial.

| Information | Value used as an example for this tutorial |
| :---------- | :----------------------------------------- |
| Domain      | django.demo-cloudweb.ovh                   |
| Root folder | django                                     |
| Runtime     | Python 3                                   |

As for the additional options, choose the ones you want to enable. Once the information is filled in, click `Next`, then complete the operation. This addition can take up to one hour. However, changing the DNS configuration can take up to 24 hours to become fully effective. If you want more information about managing multisites, refer to our guide [“Sharing your hosting between several websites”](/de/guides/web-cloud/web-hosting/multisites-configure-multisite.md).

![django-cloud-web](/images/assets/screens/control-panel/product-selection/web-cloud/cloud-web/multisite/add-a-domain-or-sub-domain-step-2-django.png)

### Step 3: connect to your Cloud Web via SSH

First, retrieve the information that lets you connect. To do this, go to the `FTP - SSH` tab. If it does not appear in the list, first click the button with three bars. The information related to your storage space is then displayed. Locate the items mentioned next to the following elements:

| Elements                  | Description                                                                                                                                                                                                                                                                                                                                                                                       |
| :------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| SSH access to the cluster | The element that appears lets you retrieve two pieces of information: the server address (it starts after “ssh://” and ends before the “:”) and the connection port (the number is mentioned after the “:”). For example, we might find: _ssh://sshcloud.cluster024.hosting.ovh.net:12345/_, so “_sshcloud.cluster024.hosting.ovh.net_” as the server address and “12345” as the connection port. |
| Main SSH login            | This is the main SSH username created on your hosting.                                                                                                                                                                                                                                                                                                                                            |

If you no longer know the password of the SSH user, click the `...` button to the right of the relevant user in the table, then `Change password`.

![django-cloud-web](/images/assets/screens/control-panel/product-selection/web-cloud/cloud-web/ftp-ssh/change-password.png)

Now, to connect via SSH, you need to use a terminal. This tool is installed by default on macOS or Linux. A Windows environment will require installing software such as PuTTY or adding the “OpenSSH” feature. As this procedure is specific to the operating system you use, we cannot detail it in this documentation.

Here is an example of a command line you can use. Replace the elements “sshlogin”, “sshserver” and “connectionport” with the ones suited to your own situation. Once the command is sent, you will be prompted to enter the password of the SSH user.

```sh
ssh sshlogin@sshserver -p connectionport
```

### Step 4: prepare the Python environment

We will now prepare the Python environment needed to host our Django CMS application. The goal is to isolate the Python files and the dependencies of our application from the rest of the Python files and libraries present on the system. In the Python ecosystem, this isolation is easy to set up thanks to the `virtualenv` utility.

From the SSH connection open on your Cloud Web, install virtualenv via pip (it is the most widely used package manager for the Python language):

```sh
democld@cloudweb-ssh:~ $ pip3 install --user virtualenv
Collecting virtualenv
  Downloading https://files.pythonhosted.org/packages/4f/ba/6f9315180501d5ac3e707f19fcb1764c26cc6a9a31af05778f7c2383eadb/virtualenv-16.5.0-py2.py3-none-any.whl (2.0MB)
    100% |################################| 2.0MB 164kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-16.5.0
```

Modify the PATH environment variable to add the freshly installed “virtualenv” command:

```sh
democld@cloudweb-ssh:~ $ export PATH=$PATH:~/.local/bin
democld@cloudweb-ssh:~ $ virtualenv --version
16.5.0
```

You can make this change to your “PATH” persistent by adding the export to the “\~/.profile” file:

```sh
democld@cloudweb-ssh:~ $ echo "export PATH=$PATH:~/.local/bin" >> ~/.profile
```

You can now move into the “django” folder and create a _virtualenv_, which we will name “venv” for this tutorial.

```sh
democld@cloudweb-ssh:~ $ cd django/
 
democld@cloudweb-ssh:~/django $ virtualenv venv
Using base prefix '/usr'
New python executable in /home/democld/django/venv/bin/python3
Not overwriting existing python script /azehome/democld/django/venv/bin/python (you must use /home/democld/django/venv/bin/python3)
Installing setuptools, pip, wheel...
done.
```

Now that your _virtualenv_ is in place, you can access it via the command “source \< virtualenv name >bin/activate”. Once inside your _virtualenv_, all the packages and libraries you install will be installed only here.

When your _virtualenv_ is activated, you see in your terminal your prompt preceded by “(venv)” (or another name, if you chose a different one when creating the _virtualenv_). You can exit this _virtualenv_ at any time, using the “deactivate” command.

```sh
democld@cloudweb-ssh:~/django $ source venv/bin/activate
(venv) democld@cloudweb-ssh:~/django $
```

### Step 5: install and configure Django CMS

Django CMS provides a utility named “djangocms-installer” to ease its installation.

Still from within your _virtualenv_, install this utility with pip:

```sh
(venv) democld@cloudweb-ssh:~/django $ pip install djangocms-installer
Collecting djangocms-installer
  Downloading https://files.pythonhosted.org/packages/b9/32/882c86fd8efe8c1bb802f04a8ed649e8b74ff77a83f4201b37073c6d9b8f/djangocms_installer-1.1.0-py2.py3-none-any.whl (55kB)
     |################################| 61kB 4.2MB/s
Collecting six (from djangocms-installer)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting dj-database-url>=0.4 (from djangocms-installer)
  Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
Requirement already satisfied: pip in ./venv/lib/python3.5/site-packages (from djangocms-installer) (19.1)
Collecting tzlocal (from djangocms-installer)
  Downloading https://files.pythonhosted.org/packages/cb/89/e3687d3ed99bc882793f82634e9824e62499fdfdc4b1ae39e211c5b05017/tzlocal-1.5.1.tar.gz
Collecting pytz (from tzlocal->djangocms-installer)
  Downloading https://files.pythonhosted.org/packages/3d/73/fe30c2daaaa0713420d0382b16fbb761409f532c56bdcc514bf7b6262bb6/pytz-2019.1-py2.py3-none-any.whl (510kB)
     |################################| 512kB 1.4MB/s
Building wheels for collected packages: tzlocal
  Building wheel for tzlocal (setup.py) ... done
  Stored in directory: /home/democld/.cache/pip/wheels/15/ae/df/a67bf1ed84e9bf230187d36d8dcfd30072bea0236cb059ed91
Successfully built tzlocal
Installing collected packages: six, dj-database-url, pytz, tzlocal, djangocms-installer
Successfully installed dj-database-url-0.5.0 djangocms-installer-1.1.0 pytz-2019.1 six-1.12.0 tzlocal-1.5.1
 
(venv) democld@cloudweb-ssh:~/django $ which djangocms
/home/democld/django/venv/bin/djangocms
```

Now that this utility is installed, we will use it to create our Django CMS application. Still from within your _virtualenv_ and placed in the root directory of your site (django in this tutorial), run the following command:

```sh
djangocms -f -p . mysite -s
```

Here is some information about the meaning of the options (you can find all the available options via the command “djangocms --help”):

- -f: installs and configures the “django-filer” plugins;
- -p . : uses the current folder as the parent folder of our new Django CMS project;
- mysite: name of your new project;
- -s: do not check whether the current folder is empty.

```sh
(venv) democld@cloudweb-ssh:~/django $ djangocms -f -p . mysite -s
Creating the project
Please wait while I install dependencies
If I am stuck for a long time, please check for connectivity / PyPi issues
Dependencies installed
Creating the project
Operations to perform:
  Apply all migrations: admin, auth, cms, contenttypes, djangocms_column, djangocms_file, djangocms_googlemap, djangocms_link, djangocms_picture, djangocms_snippet, djangocms_style, djangocms_text_ckeditor, djangocms_video, easy_thumbnails, filer, menus, sessions, sites
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  .....
  Applying sites.0002_alter_domain_unique... OK
Creating admin user
All done!
Get into "/home/democld/django" directory and type "python manage.py runserver" to start your project
 
(venv) democld@cloudweb-ssh:~/django $ ls -l
total 778
drwxr-xr-x 2 democld democld      3 Apr 30 16:21 __pycache__
-rwxr-xr-x 1 democld democld    804 May  7 10:54 manage.py
drwxr-xr-x 2 democld democld      2 May  7 10:54 media
drwxr-xr-x 5 democld democld      9 May  7 10:54 mysite
-rw-r--r-- 1 democld democld 741376 May  7 10:55 project.db
drwxr-xr-x 2 democld democld      2 Apr 30 15:09 public
-rw-r--r-- 1 democld democld    451 May  7 10:55 requirements.txt
lrwxrwxrwx 1 democld democld     21 Apr 30 16:20 server.py -> /usr/share/ovh/app.py
drwxr-xr-x 2 democld democld      2 May  7 10:54 static
drwxr-xr-x 4 democld democld      4 May  6 11:33 venv
```

### Step 6: link Django CMS to your Cloud Web runtime

Django CMS is now installed on your Cloud Web.

The “manage.py” file was created automatically during this operation. Modify it with the following content:

```sh
(venv) democld@cloudweb-ssh:~/django $ cat /dev/null > manage.py
 
(venv) democld@cloudweb-ssh:~/django $ vim manage.py
import sys, os
 
cwd = os.getcwd()
INTERP = cwd+'/venv/bin/python'
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
  
sys.path.append(cwd)
sys.path.append(cwd + '/venv')
  
sys.path.insert(0,cwd+'/venv/bin')
sys.path.insert(0,cwd+'/venv/lib/python3.5/site-packages')
  
os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
```

When configuring the Python runtime (see Step 1), we defined the launch script of our application as “server.py”. However, Django CMS uses a file named “manage.py”. To link Django CMS to your runtime, create a symbolic link between “server.py” and “manage.py”:

```sh
(venv) democld@cloudweb-ssh:~/django $ ln -fs manage.py server.py
(venv) democld@cloudweb-ssh:~/django $ ls -l
total 778
drwxr-xr-x 2 democld democld      3 Apr 30 16:21 __pycache__
-rwxr-xr-x 1 democld democld    804 May  7 10:54 manage.py
drwxr-xr-x 2 democld democld      2 May  7 10:54 media
drwxr-xr-x 5 democld democld      9 May  7 10:54 mysite
-rw-r--r-- 1 democld democld 741376 May  7 10:55 project.db
drwxr-xr-x 2 democld democld      2 Apr 30 15:09 public
-rw-r--r-- 1 democld democld    451 May  7 10:55 requirements.txt
lrwxrwxrwx 1 democld democld      9 May  7 11:32 server.py -> manage.py
drwxr-xr-x 2 democld democld      2 May  7 10:54 static
drwxr-xr-x 4 democld democld      4 May  6 11:33 venv
```

Modify the “mysite/settings.py” file with the following command, replacing “django.demo-cloudweb.ovh” with the address of your multisite (configured in Step 2):

```sh
(venv) democld@cloudweb-ssh:~/django $ sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = ['django.demo-cloudweb.ovh']/" mysite/settings.py
```

### Step 7: restart the Python _daemon_

To restart the Python _daemon_
, return to your OVHcloud Control Panel
. Go to the `Multisite`
 tab, click the `...`
 button to the right of the relevant domain name, then choose `Restart`
.
Once this is done, the application will be accessible via the domain name chosen in your multisite configuration.

![django-cloud-web](/images/assets/screens/control-panel/product-selection/web-cloud/cloud-web/multisite/restart-python3.png)

Congratulations, your website using Django CMS is now available! An administrator account has been created by default, with “admin”/“admin” as the login/password. Remember to change this password.

![django-cloud-web](/images/assets/screens/other/cms/django/installation-successfull.png)

### Step 8: use HTTPS

For added security on your site, you can set up an automatic redirect from HTTP to HTTPS. To do this, while still in the django folder, create a .htaccess file with the following content:

```sh
RewriteEngine On
RewriteCond %{ENV:HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
```

### Conclusion

We have seen how to install a Python application on a Cloud Web hosting plan, following the various steps. All that remains is to use Django CMS and publish your first content!

You will find more information about Django CMS and its features in the [official project documentation](https://docs.django-cms.org/en/latest/).

## Go further

[Migrating my website to OVHcloud](/de/guides/web-cloud/web-hosting/hosting-migrating-to-ovh.md)

[Putting my website online](/de/guides/web-cloud/web-hosting/hosting-how-to-get-my-website-online.md)

[Installing your website with the 1-click modules](/de/guides/web-cloud/web-hosting/cms-install-1-click-modules.md)

[Sharing your hosting between several websites](/de/guides/web-cloud/web-hosting/multisites-configure-multisite.md)

For specialised services (SEO, development, etc.), contact the [OVHcloud partners](https://partner.ovhcloud.com/de/directory/).

If you would like assistance using and configuring your OVHcloud solutions, we invite you to consult our various [support offers](https://www.ovhcloud.com/de/support-levels/).

Join our [community of users](https://community.ovhcloud.com/).
