Book Image

OpenShift Cookbook

By : Shekhar Gulati
Book Image

OpenShift Cookbook

By: Shekhar Gulati

Overview of this book

Table of Contents (19 chapters)
OpenShift Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Running OpenShift on a Virtual Machine
Index

Working with Python application logs


In this recipe, you will learn how to add view and logging to your Python applications. As discussed in Chapter 8, OpenShift for Python Developers, OpenShift Python applications use Apache with mod_wsgi.

Getting ready

This recipe will use the application created in the Creating and deploying Flask web applications using Python and PostgreSQL cartridges recipe in Chapter 8, OpenShift for Python Developers. You can recreate the application using the following command:

$ rhc create-app jobstore python-2.7 postgresql-9.2 --from-code https://github.com/OpenShift-Cookbook/chapter8-jobstore-python-flask.git

How to do it…

Perform the following steps:

  1. Open a new command-line terminal, and navigate to the directory where you have created the Python application.

  2. To view the logs of a Python application, run the following command:

    $ rhc tail --files */log*/python.log
    
  3. By visiting the application URL, you will see the following logs in the rhc tail command output when you...