fabric-deploy-django / README.txt

fabric-deploy-django
------------------

Easily reusable fabfile that can be used with the fabric application 
to quickly deploy a Django project using Apache, mod_wsgi, virtualenv 
and pip.


Dependencies
------------

You will need to have fabric installed to use this fabfile. Install it
it like so:

$ sudo pip install fabric

It was written for Python 2.6+

If you use a Python version less than 2.6 then please refer to this 
URL:

http://docs.fabfile.org/0.9.2/#documentation

You will need to add the following to your fabfile.py:

from __future__ import with_statement


Install
-------

Simply copy the fabfile.py to the root of your project directory and 
edit the fabfile.py to fit your project.

Project structure should look like so:

myproject/
  apache/
    wsgi_handler.py
    myproject.conf
  requirements.txt
  fabfile.py
  myproject/
    __init__.py
    urls.py
    settings.py


Configure
---------

Edit the following globals:


env.project_name = 'PROJECT_NAME'

This is the name the project (ie, "myproject" above in the structure example)


env.run_south_migrate = True

Run 'python manage.py migrate' after syncdb is run.


env.copy_base_settings_local = False

If true, the script will look for a file named myproject/base_settings_local.py
and copy it to myproject/settings_local.py


env.num_releases = 7

The number of old releases to leave on the deploy destination.


Edit the 3 deploy defining functions in the fabfile (local, staging, prod):


env.hosts = ['localhost']

Host(s) that the commands should be run on


env.path = '/path/to/envs/myproject'

Path for this project to be deployed to.


env.user = 'yourusername'

The username to run the commands as


env.run_type = 'local'

If this is set to 'local' then the internal function _is_local() will evaluate 
to True. This means that the deploy is actually being run on the LOCAL machine.
This is mostly used for testing the deploy process. Anything other than 
'local' will mean that the deploy will be run on whatever hosts are set in 
"env.hosts"


env.repo_path = '/path/to/local/repo/myproject'

Path (local FS or URL) to the repository to clone (or pull from) during the 
deploy.


env.repo_rev = 'tip'

The revision to use when pulling/cloning from the repository 
(set in env.repo_path above) 


Use
---

Here is a basic deploy to the LOCAL machine:

$ fab local setup

Or say to the production environment:

$ fab prod setup


TODO
----
Create a more through install and use docs.

Auto import __future__ if using Python < 2.6

Make various functions more loosely coupled to the tools currently.
(ie, easy to switch from deploying with hg to git or svn, etc.)


Copyright & Warranty
--------------------
All documentation, libraries, and sample code are 
Copyright 2010 Peter Sanchez <petersanchez@gmail.com>. The library and 
sample code are made available to you under the terms of the BSD license 
which is contained in the included file, BSD-LICENSE.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.