Skip to content

Instantly share code, notes, and snippets.

@danigosa
Created August 8, 2014 09:44
Show Gist options
  • Save danigosa/b46eeedb70529064cbb9 to your computer and use it in GitHub Desktop.
Save danigosa/b46eeedb70529064cbb9 to your computer and use it in GitHub Desktop.
Recipe for Python 3.4 on Ubuntu 14.04
#
# Target OS Ubuntu Server 14.04 Trusty
# Chef 11.8.2
# Author: danigosa
# Date: 17/04/2014
#
#
include_recipe "provision::common"
##########################################################
# INSTALL VIRTUALENV
##########################################################
execute "install-virtualenv" do
user "root"
cwd "root"
command "pip install virtualenv"
action :run
end
execute "create-virtualenv-py2k" do
user "vagrant"
cwd "/home/vagrant"
command "virtualenv devenv"
action :run
end
execute "create-virtualenv-py3k" do
user "vagrant"
cwd "/home/vagrant"
command "virtualenv -p /usr/bin/python3 devenvpy3k"
action :run
end
##########################################################
# DJANGO SETUP
##########################################################
script "django-installation-py2k" do
user "vagrant"
cwd "/vagrant/"
interpreter "bash"
code <<-EOH
source /home/vagrant/devenv/bin/activate
pip install -r /vagrant/requirements/dev.txt
deactivate
EOH
end
script "django-installation-py3k" do
user "vagrant"
cwd "/vagrant/"
interpreter "bash"
code <<-EOH
source /home/vagrant/devenvpy3k/bin/activate
pip install -r /vagrant/requirements/dev.txt
deactivate
EOH
end
script "django-app-setup" do
user "root"
cwd "/vagrant/"
interpreter "bash"
code <<-EOH
find . -name '*.pyc' -delete
mkdir -p logs
chmod +x logs
touch logs/django.log
touch logs/django_request.log
EOH
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment