-
Notifications
You must be signed in to change notification settings - Fork 7
deploy reStructuredText
Download example deployment scripts and documentations: $ git clone git@github.com:ddehghan/django-deploy-starterkit.git
So you've setup python and django locally, gone through a tutorial and created a working django application. Next you will deploy your site to a public server so you can show your mom :) No matter what OS you're running, the strategy around deploying your site includes these basic steps:
- Deploy locally to a staging environment and test
- Deploy to Production Server
The first thing you will do is replicate your server environment locally in a staging environment so that your development environment is as similar as possible to Production. You'll do this by setting up a virtual machine so you can test your app and sort out any problems before deploying to your server. Here’s how to virtualize an Ubuntu server on your virtual machine with Virtual Box.
Virtual Box http://www.virtualbox.org/wiki/Downloads Virtual Box user guide http://www.virtualbox.org/manual/UserManual.html
Setup Vagrant http://vagrantup.com/docs/getting-started/index.html Windows users will need to set up Putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Download a 32bit virtual machine. You only need to do this once
$ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
Notes: the files that you download will be automatically saved in ~/.vagrant.d/boxes/ You only need to download a base image once. after that you can instantiate clones of this base image multiple times.
$ cd vagrant
$ vagrant up
Notes: 'Vagrant up' will read the Vagrantfile and instantiate a new vm for you. You will see this output:
(dev)mymachine@~/gitroot/django-deploy-starterkit/vagrant: vagrant up
[web_server_1] Fixed port collision 'ssh'. Now on port 2202.
[web_server_1] Importing base box 'lucid32'...
[web_server_1] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.
Guest Additions Version: 4.1.0
VirtualBox Version: 4.1.2
[web_server_1] Preparing host only network...
[web_server_1] Matching MAC address for NAT networking...
[web_server_1] Clearing any previously set forwarded ports...
[web_server_1] Forwarding ports...
[web_server_1] -- ssh: 22 => 2202 (adapter 1)
[web_server_1] Creating shared folders metadata...
[web_server_1] Running any VM customizations...
[web_server_1] Booting VM...
[web_server_1] Waiting for VM to boot. This can take a few minutes.
[web_server_1] VM booted and ready for use!
[web_server_1] Enabling host only network...
[web_server_1] Mounting shared folders...
[web_server_1] -- v-root: /vagrant
Once you are satisfied with your app you will want to deploy to your server. Use fabric to automate the deployment from your staging to production server.