Putting it all together

Restart your Nameko services and let's try this out in the browser:

It's worked... sort of! The messages we stored in Redis earlier are present, which means the logic in our template is functioning properly, but we also have all of the HTML tags and indentation from our home.html.

The reason for this is because we haven't yet specified any headers for our HTTP response to indicate that it is HTML. To do this, let's create a small helper function outside of our WebServer class, which will convert our rendered template into a response with proper headers and a status code.

In our service.py, amend our imports to include: ...

Get Python Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.