Skip to Content
Learning Apache OpenWhisk
book

Learning Apache OpenWhisk

by Michele Sciabarrà
July 2019
Intermediate to advanced
391 pages
8h 40m
English
O'Reilly Media, Inc.
Content preview from Learning Apache OpenWhisk

Chapter 9. An OpenWhisk Web Application in Python

In this chapter, we are going to develop a non-trivial example of an OpenWhisk Python application using CouchDB/Cloudant. The application we are going to develop is a database table editor. The goal is to demonstrate coding in Python, by creating a web user interface that interacts with databases in OpenWhisk. We also cover testing in depth.

For illustration purposes, the application is actually split into two implementations. First we’ll build a basic application, with bare-bones functionality. Then we’ll create a more advanced implementation, with more complex features.

Note

The source code for the examples related to this chapter is available in the GitHub repository.

CRUD Application Architecture

In the basic application, we cover:

  • Implementation and testing of database operations in Python

  • Creation and testing of a simple HTML user interface

  • Implementation and testing by “mocking” of the application control logic

The application, shown in Figure 9-1, has a simple structure. It uses only HTML tables and forms, and a bit of client-side JavaScript. We keep the application features to an absolute minimum here and instead focus on OpenWhisk coding techniques, avoiding too many implementation details. We follow the usual Model-View-Controller pattern for a web application, splitting it into three modules: model.py, view.py, and control.py.

Figure 9-1. CRUD application user interface

When invoked, the application shows ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learning Docker

Learning Docker

Rick Fast
Apache Cookbook, 2nd Edition

Apache Cookbook, 2nd Edition

Rich Bowen, Ken Coar

Publisher Resources

ISBN: 9781492046158Errata Page