Skip to content

Instantly share code, notes, and snippets.

@miohtama
Created July 24, 2011 09:37
Show Gist options
  • Save miohtama/1102448 to your computer and use it in GitHub Desktop.
Save miohtama/1102448 to your computer and use it in GitHub Desktop.
How to start developing plone

Sauna Sprint 2011 head first group 2011-07-24

How to start developing Plone - from the scratch approach.

Use man pages, info pages and commandline help before asking others, please.

Install virtualenv

  • Use your operating system package manager

(HOWTO on Windows?)

(HOWTO on OSX)

(HOWTO on Ubuntu/Debian)

You need the following packages installed:

sudo apt-get install python-dev build-essential
  • build-essential installs C compiler needed to build native Python extensions (as needed by easy_install and such later)
  • python-dev install Python development headers, needed to build native Python extensions

Create virtualenv

Virtualenv is an isolated Python environment where you can freely install Python packages without accidentally break your computer. It installs all packages to your home folder, not on your operating system.

We'll create a virtualenv environment called plone which has no system packages

virtualenv --no-site-packages plone

To get more help you can use commmand virtualenv --help.

Python 2.6 must be used, but it is default Python version on all OS when writing this.

Activate virtualenv

Virtualenv creates a script called "activate" which sets environment variables and forces you to use Python created by virtualenv - this is not system wide Python installation, but one for messing up.

Note

You need to activate virtualenv once per each terminal session. It will enable the isolated Python environment for the current shell session.

Use command:

source plone/bin/activate

And your command prompt changes (Ubuntu/OSX) saying plone:

(plone) $

Or you can check if you see your virtualenv in your PATH environment variable (PATH tells where the OS pulls commands which you use on the command prompt)

env | grep PATH
...
PATH=/Users/moo/plone/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

You see your plone virtualenv folder as the first entry.

Install ZopeSkel

ZopeSkel is the collection of project templates which you use for Plone development.

Python installs packages to a magical folder called site-packages. This is either

  • virtualenv
  • operating system location (on Linux /usr/lib/python2.6)

The packages are installed using easy_install command provided by Python setuptools or Distribute packages.

easy_install ZopeSkel

Create buildout using zopeskel

The following command creates a folder structure for ZopeSkel based Plone installation.

zopeskel plone4_buildout myplone4buildout

plone4_buildout is the template name which ZopeSkel uses to build a project folder structure.

myplone4buildout is the name of the folder which is created.

Hit enter to all questions.

If you later want to change answers to the questions, like update your Plone version, edit file buildout.cfg and change the line:

extends =
   http://dist.plone.org/release/4.0.1/versions.cfg

find-links =
   http://dist.plone.org/release/4.0.1

(Change 4.0.1) there.

Bootstrap buildout

Bootstrap is a process which runs the buildout for the first time and fixes buildout to use the current Python interpreter (one coming from your virtualenv in this point). You need to do this only once.

python bootstrap.py

Build it out

Buildout is a "repeated configuration tool" which will automatically download, install and configure software for your system.

  1. build it out, launch the instance and report back - we will get into trimming down your buildout file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment