Mixing Plone and Django for explosive results
-
Upload
simone-deponti -
Category
Documents
-
view
3.948 -
download
1
description
Transcript of Mixing Plone and Django for explosive results
![Page 1: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/1.jpg)
C³: Mixing Plone and Django
for explosive results!
![Page 2: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/2.jpg)
The requirements
● a modern e-commerce platform
● with a good contents story
● and advanced community features
![Page 3: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/3.jpg)
Plone alone... will get it done?
a good web CMS like Plone has no clue of:● e-commerce needs● advanced community features
no known Plone extension could convince us and...
we didn't want to start any new Plone project with this needs
![Page 4: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/4.jpg)
The quest for a good solution
The Graal should:● be python based
(we ♥ python!)● not reinvent the wheel● be open source● have a community
behind
(we ♥ happy customers)
![Page 5: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/5.jpg)
Attack of the ponies
We looked at Django:● good and stable since
years● with a strong and
passionate community● had a proven
ecommerce solution and a proven community solution
![Page 6: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/6.jpg)
The evil plan
![Page 7: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/7.jpg)
Satchmo, the e-commerce
http://www.satchmoproject.com/● feature rich● flexible as we needed● with a group of people really
using and improving it
![Page 8: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/8.jpg)
Pinax, the community
http://pinaxproject.com/● a suite of modules for community
purposes● reuse what's already there● good working example projects included
![Page 9: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/9.jpg)
Why Plone then?
talking about web CMSs:● python based
(we ♥ python!)● not reinvent the wheel● open source● with a community behind
(we ♥ happy customers)● "nothing compares to you"
![Page 10: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/10.jpg)
It's a long way to the top
● integration, integration, integration● choices, choices, choices
looking for sustainable and elegant solutions
![Page 11: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/11.jpg)
The Plone and Django dance
a coreographer's job● Don't stomp on each
other's feet● Don't do the same
things twice
![Page 12: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/12.jpg)
The dance steps
● common theming via Diazo● don't store the same data
twice● let one see what the other
does
![Page 13: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/13.jpg)
Ballet's preview
![Page 14: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/14.jpg)
What about the users?
● CMS users are content editors● they do not mix with the
common people
● Users are common across Django apps● but not across Plone
![Page 15: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/15.jpg)
I'm sure I had it somewhere
● Plone needs to read from the database
● sqlalchemy? Duplication of code
![Page 16: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/16.jpg)
To import or not to import django.db.models?
It is nobler in the code to suffer:● The thousand errors of
circular dependencies● Or to take arms against
settings.py, and by fixing that end them
Hamlet did it wrong
![Page 17: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/17.jpg)
Syncronizing the dancers
● Django handles the transaction trasparently via middleware
● Hook up the right methods to Zope's transaction machinery
![Page 18: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/18.jpg)
I've got a fever, and the only cure is... less code!
● Sharing the same logic between Django and Plone views
● Using django templates in Plone
● That's the python, baby (and you just have to enjoy it)
![Page 19: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/19.jpg)
Murphy's impedance
Some things we didn't quite consider● Internationalization and language
selection syncing● Linking content between systems● Paster vs nginx
![Page 20: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/20.jpg)
Building the launch ramps
● Single buildout● Paster+SQLite for
development● Quick, pain-free setup
● PostgreSQL+nginx+uwsgi for deployment● More robust but also more
convoluted
![Page 21: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/21.jpg)
Traps and dark pits
● The Content-Length problem● Aka “Hello nginx, I have
some bytes for you”
● Where's that cookie coming from?● An i18n tale of horrors
![Page 22: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/22.jpg)
The duct-taped parts
● Static files and media files● The slow agony of
settings.py
![Page 23: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/23.jpg)
And in the end... they all lived on github
● djc.recipe● ~collective/collective.django
![Page 24: Mixing Plone and Django for explosive results](https://reader034.fdocuments.us/reader034/viewer/2022051311/540698fb8d7f72d8088b466f/html5/thumbnails/24.jpg)
Towards the infinite, and beyond
● Integrating users (PAS+repoze.who)
● Making development faster
● Managing themes and files easily