Vagrant and Django-CMS install

Example of using Vagrant to install Django-cms

I use KVM on my laptop so I use the provider “libvirt”

Vagrant defaults to VirtualBox.

You will need to have Vagrant and the provider installed to get this going.

In the code, I use the vagrant box centos/7.  I am a RHEL guy so I choose Centos when I am installing or testing any software.

The provision section SHELL will install the necessary software on the initial “vagrant up”

The ALWAYSDO provision section will run the the django-cms software on every “vagrant up”

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.network "forwarded_port", guest: 80, host: 18080
  config.vm.provider "libvirt" do |vb|
  end
  config.vm.provision "shell", inline: <<-SHELL
    yum -y install epel-release
    yum -y install python-pip
    yum -y install python-virtualenv
    cd /opt
    pip install --upgrade virtualenv
    virtualenv env
    source env/bin/activate
    pip install djangocms-installer
    djangocms mysite
  SHELL
  config.vm.provision "shell", run: "always", inline: <<-ALWAYSDO
    cd /opt/mysite
    source env/bin/activate
    python manage.py runserver 0.0.0.0:80 &
  ALWAYSDO
end