Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install collective.django

How to install collective.django

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install collective.django
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.2 Available View build log
0.1 Failed View build log
Windows (64-bit)
0.2 Available View build log
0.1 Failed View build log
Mac OS X (10.5+)
0.2 Available View build log
0.1 Failed View build log
Linux (32-bit)
0.2 Available View build log
0.1 Failed View build log
Linux (64-bit)
0.2 Available View build log
0.1 Failed View build log
 
License
BSD
Lastest release
version 0.2 on Sep 29th, 2011

This package allows you to use the Django ORM within Plone.

It takes care to merge Django transaction management within Zope's own transaction manager.

Basic usage

In order to use this package you must have a setup that looks like the following:

  1. Your settings module must be within buildout's "adjusted" sys.path. This means it should be importable from within Plone, hence that it should be an egg (either released or more commonly in development). Jacob Kaplan-Moss explains how to do this for a Django buildout.
  2. Your buildout should contain both the Plone parts and the Django parts together, hence the standard Plone buildouts plus the bits you see in Jacob's tutorial. Make sure that your plone instance has, within its eggs, the project one (shorturls in Jacob's example) either derived from buildout's ones or local to the instance.

The second step is to make sure that your Plone instance has a special environment variable that Django needs to know where its settings are. Hence put, under your instance buildout section, something like this:

[buildout]
...
[instance]
recipe = plone.recipe.zope2instance
...
environment-vars =
    DJANGO_SETTINGS_MODULE shorturls.testsettings

Again values are borrowed from Jacob's post.

Note

Please note that this environment variable will be set only if you run bin/instance. Therefore when using supervisord, make sure you have it run bin/instance console and not any run.py script directly which would completely bypass setting the environment variable and leave you in the mud.

Then just add the egg to your buildout, like this:

[buildout]
...
eggs =
    ...
    collective.django

The package itself relies on z3c.autoinclude to load its ZCML when Plone is pulled up. In case this does not work, include a:

<include package="collective.django" />

Within your package ZCML.

And whenever you will import your Django models from Plone, the transaction will be managed by Zope.

Testing

To run the tests, a minimal buildout is included. After checking out the source code, run the following:

$ python bootstrap.py
$ bin/buildout
$ bin/test

And the tests should be ran.

Changelog

0.2 (2011-09-28)
  • fix bad release
0.1 (2011-09-16)
  • Django 1.3 compatibility and initialization fixes [vangheem]
  • Initial public version [shywolf9982]

Contributors

A big thanks to the developers of zope.sqlalchemy for providing a good "template".

Initial developement supported by Abstract Open Solutions

Subscribe to package updates

Last updated Sep 29th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.