måndag 3 maj 2010

Plone dev on Snow Leopard, the real McCoy

I've got it down now. This is the way to set up your Snow Leopard for some serious Plone (>3.2) development. I work on Plone 3.3.5.

First, Get Xcode and MacPorts. Not entirely sure whether you need it with the instruction below, but it won't hurt unless you're really tight on disk space.

Now, don't even try to use any boiler plate Python-distributions for Mac OS X. The one that ships with Snow Leopard [SL] is of the wrong minor version, you need 2.4 and it's 2.6. The one that comes with Mac Ports doesn't work either because of some missing compiler directives, even though it's of the correct version. No, you have trust Florian to provide you with the Python-distro. Thus, in your directory of choice;

> svn co http://svn.plone.org/svn/collective/buildout/python/
> cd python

Next, you need easy_install for the native Python environment. You get it from http://peak.telecommunity.com/dist/ez_setup.py, and run;

> /usr/bin/python ez_setup.py

Now, use the SL native python interpreter (/usr/bin/python) to

> /usr/bin/python bootstrap.py

Next you build the python environment, but before you do that, take a look in buildout.cfg. Comment out or remove the lines with python25 and python26 if you don't explicitly want those. You don't need them for the purposes here.

> ./bin/buildout

After this step you have a Python distribution that will work for Plone. This is the Python that you'll have to use henceforth. You could set up your system path $PATH to point to this Python to not have to specifically point to it all the time.

> export MY_PYTHON=[the source directory]/python/python2.4
> export PATH=$MY_PYTHON/bin;$PATH

Next, get ZopeSkel;

> python-2.4/bin/easy_install -U ZopeSkel

And you're ready to go! The "paster" tool should be installed (try running "python-2.4/bin/paster create --list-templates"), which is the template engine for creating Plone things. From this point on, you have a working Python environment for working with Plone buildouts for your projects, which is currently the preferred way to do things. Feel free to dig into the tutorials at plone.org, e.g.

Creating a buildout for your project

Setting up Mac OS X Snow Leopard for Plone development Part 2

Ok, so I think I'll do the development as a buildout (as recommended from Plone 3.2 and on). That makes things a bit more exciting, as a bit more preparation is needed. These are the steps I've taken to date.

Given that I've done EVERY step in Part 1 of this tutorial, I continue as follows. My project is called sofitel, for undisclosed reasons. Therefor a create a buildout called sofitel in my source code directory (~/development/buildouts). BTW, I'm following this tutorial on plone.org.

> paster create -t plone3_buildout sofitel
> cd sofitel
> python2.4 bootstrap.py

The next step is checking your buildout.cfg and running ./bin/buildout, and this is where I ran into trouble. What happened for me was that the simplejson v2.0.9 egg did not install properly, resulting in the buildout ending with an error. After searching for help on the internet for several seconds, I concluded that the best way forward was to install simplejson the non-egg way. Hence,

> wget http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz#md5=af5e67a39ca3408563411d357e6d5e47
> tar xzf simplejson-2.0.9.tar.gz
> cd simplejson-2.0.9
> sudo python2.4 setup.py install
> sudo python2.4 setup.py clean

I realize that the setup.py steps above perhaps are not all necessary, but anyway they worked for me. What comes after this is;

> ./bin/buildout

Given that you're still in your /sofitel directory. Hope it works for you! =)

tisdag 20 april 2010

Setting up Mac OS X Snow Leopard for Plone development Part 1

Note to self; don't run around the internet for several days next time you need to setup a workstation for Plone development. So, here are the steps I've taken.


First, as always, do a selfupdate of the macports.
> sudo port selfupdate && sudo port upgrade outdated

!!! The section below is not correct! Please see the post that is Part 3 of my instruction before going any further!!!

Get Python 2.4
> sudo port install python24 python_select
> sudo python_select python24

!!! From here and on, the steps are correct !!!

Get wget
> sudo port install wget

Get easy_install
> wget http://peak.telecommunity.com/dist/ez_setup.py

Install easy_install.
> sudo python2.4 ez_setup.py

To reinstall setuptools (which shouldn't be necessary in most cases), remove the installed package and reinstall it. Thus;
> sudo rm -rf /opt/local/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg
> sudo python2.4 ez_setup.py -U setuptools

Now, install ZopeSkel
> sudo easy_install -U ZopeSkel

And you're ready to go! The "paster" tool should be installed (try running "paster create --list-templates"), which is the template engine for creating Plone things.

fredag 29 januari 2010

Setting up Mac OS X Snow Leopard for Django/Couchdb RESTful development

For starters, get Xcode and MacPorts if you don't have it. This step will take you a while if don't already have this installed.

http://developer.apple.com/tools/xcode/
http://www.macports.org/install.php

Second, as a rule of thumb, do a selfupdate of mac ports before you start dabbling with it.

>sudo port selfupdate
>sudo port upgrade outdated

Then, get the following ports; couchdb, mod_python26 (if python -V says you're using 2.6, which it currently should). This could take some time, because there are quite a few dependencies.

>sudo port install couchdb mod_python26

While you do this. Consider what other kind of development tools you like, like code editor and so forth. I'm trying Espresso for the moment, a nice looking animal that I got through the last MacHeist. I'm leaving it to you to find your own way.

Next, load the python-module in you apache installation. After you installed the port, the install script says how to do it.

Here comes a manual scary step. Install Django. Do it like they tell it...

http://www.djangoproject.com/download/

More to come soon when I have had time to go further myself... =)