Content: Blog

Technical articles

Exploring application integration with the django CMS Marketplace

Kim Thoenen

May 25, 2016

integration

How we use django CMS's integration features to create a live Marketplace, for Addons, people and organisations.

In a previous article, we outlined some of the ways in which django CMS makes it easy to integrate other applications into a site.

We do this ourselves for numerous parts of the django CMS website. Some of them are fairly obvious, such as the news/weblog and events sections, powered by Aldryn News & Blog and Aldryn Events respectively.

We also have some custom applications, such as for our Case Studies, where a simple application helps us manage the structured content for that section, and for the django CMS Marketplace
 

The Marketplace

The Marketplace application is unlike most django CMS applications on our site: it doesn't actually maintain any of the Marketplace data itself. In fact the Marketplace data come from an entirely different system - our Addons platform - that's integrated into the Aldryn Control Panel.

The Addons system is the backend that makes it possible for Aldryn to deploy other applications in django CMS sites, whether they are core Aldryn applications or third-party products. It hosts application code - on its own PyPI servers - and maintains extensive metadata for them (essential for application version control, for example).

We're fans of the Django principle that one should not repeat oneself, so the idea of maintaining and publishing information about Addons separately is anathema. If we have the data already, we should re-use them.
 

Getting data to the market

The Marketplace and the Addons applications live on entirely separate systems. The Addons system makes its data available over a RESTful web API, which the Marketplace application queries.

You can see examples of this across the Marketplace.
 

Featured Addons plugin

At the top of the main page, a Featured Addons plugin asks for Addons that have been appropriately flagged in the database, and displays them in a carousel (other display styles are available).

Similarly, plugins in the page pull out featured organisations, developers and websites.
 

Addons detail pages

When you select a particular Addon, you're taken to a details page for it. This time, the root page of the Browse Addons section has an apphook to the Marketplace application. This uses the URL for a particular Addon - such as https://marketplace.django-cms.org/en/addons/browse/aldryn-constantcontact/ - to query the API once more, and populate the page appropriately.
 

Choosing the right tools

The Marketplace pages use two of the integration techniques built into django CMS - Marketplace application plugins, to drop content from other elsewhere into pages laid out and structured within the CMS itself, and apphooks, to attach another application to a URL in the page structure. It also uses REST API queries from the Marketplace to the Aldryn Addons backend for the latest data for those Addons.

The main Marketplace page is a standard django CMS page. We might wish to amend its format or layout at any time, so using the flexible page layout options available in django CMS makes sense (for example, we might need to reformat the page to reflect an important new organisation in the network, or a new campaign or development).

On the other hand, each Addon needs to be presented in a very consistent way, that should rarely need to change, so we leave that to a Django page template defined by the Marketplace Addon.

In other words, we can be completely flexible about the way applications are integrated, and manage integration whether they are tightly coupled across the Python backend, or entirely decoupled and use web APIs to communicate. This allows us to develop systems without worrying about how, in the future, we might decide to integrate them - implementing integration is so easy, and can be done in so many different ways, that we can leave that question until it actually arises.

blog comments powered by Disqus

Do you want to test django CMS?

Try django CMS