Hi Stephane,

I think it is a great idea. The lambda trick means I don't have to make
any changes at all to switch between my development environment and
production. A real life example from a current project:

-----

from os.path import abspath, dirname, join
APP_PATH = lambda *x: abspath(join(dirname(__file__), *x))

MEDIA_ROOT = APP_PATH('webroot', 'media')
TEMPLATE_DIRS = (
    APP_PATH('templates'),
)

-----

Note the * on the definition for x which means you only need one lambda.

On my production machines, the websites typically run from

/home/httpd/<domain>

but on my development machine (my laptop), they run from

/home/darryl/devel/websites/<customer>/<domain>

Cheers
Darryl


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to