Setting up a peach³ development environment (on Linux)

You can use virtualenv and buildout to easily set up a working development environment for peach³.

Follow these instructions to set it up:

  • You need Python 2.6 or 2.7 installed on your system. Python 3.x is not supported yet.

  • Install the setuptools and virtualenv python packages if you do not already have them

    • To test if you have setuptools, enter easy_install on the command prompt (possibly as root). If setuptools is not already installed, download ez_setup.py and enter:

      python ez_setup.py
      

      at the location where you downloaded it, or install setuptools using your system's package manager.

    • To test if you have virtualenv, enter virtualenv on the command prompt. If virtualenv is not already installed, install it using the command:

      easy_install virtualenv
      

      or install virtualenv using your system's package manager.

  • Create a virtual python environment for peach³, using virtualenv:

    virtualenv --no-site-packages peach3-dev
    
    This will create a new directory peach3-dev and set up a virtual python environment.
    See the virtualenv documentation for more information about virtual Python environments.
  • Enter the virtual environment and activate it:

    cd peach3-dev
    source bin/activate
    
    After you have activated the virtual environment (you should see the name of your virtual environment as part of the prompt), all new Python packages will be installed to the virtual environment. To leave the virtual environment at any time, enter deactivate.
    Don't deactivate the environment just yet, we still need it.
  • Download and untar the peach³ source or clone the peach³ development project from the private repository if you have access to it:

    hg clone http://hg.peach3.nl/private/peach3-devproject devproject
    
  • Enter the devproject directory and set up the buildout environment:

    cd devproject
    python ./buildout_bootstrap.py
    

    This will bootstrap the buildout environment

  • To finally install the peach³ environment, type:

    bin/buildout -c buildout-dev.cfg
    

    This will take some time. It sometimes happens that this script just stops and sits idle. In that case just hit ctrl-c and execute the command again. It will continue where it stalled.

You now have a peach³ development environment with the peach³ source code and all packages it depends on installed. (Including the django-command-extensions, iPython and Werkzeug tools to make a developers life easier).

You will also need to set up and configure Django (editing settings.py and development.py in the peach³ directory) and set up a local database. If you don't know how it might be best to take a look at the Django tutorials. Note that peach³ has only been tested with the MySQL database backend.

After setting up the database and configuring it in the Django settings file devproject/devsite/development.py, the tables need to be created using the following command:

python ./manage.py syncdb --settings=devsite.development --migrate

This will create an empty peach³ database.

Running the development webserver

  • After you have installed peach³ and configured the database, you can run the development webserver to run a local version of peach. Go to the peach3-dev directory and activate the virtual environment:

    cd peach3-dev
    source bin/activate
    
  • Run the webserver:

    cd devproject
    python ./manage.py runserver_plus localhost:8080 --settings=devsite.development
    

    You will now have a peach³ webserver running locally. Go to http://localhost:8080/ with your browser to access it.

Acknowledgements

The virtualenv and buildout based development environment described here was inspired by a blog posting by Dan Fairs at http://www.stereoplex.com/two-voices/a-django-development-environment-with-zc-buildout