Jeroen Vloothuis and Jan Murre: Jamming with Plone and Django
By Jeroen Vloothuis and Jan Murre, Pareto, The Netherlands
This talk is about our experience with using both Plone and Django within several projects. We will tell what we did, how it worked and what didn't work.
We want to help you avoid make mistakes that we did when integration Plone and Django.
Step one in integration: buildout recipe for Django: djangorecipe.
In Apache we added rewrite rules to choose between Django and Plone. Watch out when creating an object in Plone that you can never reach because Apache rewrites that to Django.
We did a project for AcademicTransfer with Django and Plone. Job market niche for academic jobs. They had a 10-year old ColdFusion website. Vendor lock-in.
We used SOLR as a search engine. Django for the job board. Plone for the content management.
Django asks Plone for the base template, which is mostly the same as the main tamplate but with some regular expression replacements. Simple, but it breaks easily, so add unit tests. Complete control, but hard to debug. The alternative would have been Deliverance, but that technique was very young then.
Internationalization issues. Plone uses a cookie and Django uses a session. Solution: all language settings go through Django, using links.
User management was Django-only. Javascript based. The Plone users were only used for the content management. Browser does an ajax call to Plone to get the user name and Plone asks Django using the session. The javascript is cache-friendly: pages are the same for every logged in user.
RSS in portlets for the top vacancies and some more.
Another project with Django-Plone integration was for Zeelandia. They had a lot of Plone sites already, plus some Zope-only. They wanted SSO (single sign-on) with OpenId. Also a dashboard with SSO. Searching is done on multiple sites. Browser view on the Plone site is just an HTTP GET; scalable and fast. We should have used Open Search, but we only noticed that when we were done building. Security could be more advanced.
Plone user management with a PAS plugin. We made it possible to query the openid provider so we could search for users in the Plone UI. So we could have both normal and openid users.
Plone is kick-ass for content management. For more interactive stuff I would use Django.
Room: you could use server side includes to get the user information in the page so you don't use two requests from the browser.
Alec Mitchell: Why ask Plone the name and let Plone ask Django? You could ask Django directly.
Well, it was hard to test locally. We may change that. Could use JSON.