/tutorial-python

Rookout official tutorial for using Python

Primary LanguageCSS

Rookout tutorial for debugging Python applications

CircleCI License Docs GitHub version

A sample app for debugging Python using Rookout.

Helpful links:

Prerequisites

  1. Python 2.7.14 or newer
  2. pip
  3. Optional - Docker - https://www.docker.com/get-docker

Setup

  1. Clone the sample app from this repository:
git clone https://github.com/Rookout/tutorial-python.git
cd tutorial-python
  1. Set your Rookout token as an environment variable (for Windows, use set instead of export)
export ROOKOUT_TOKEN=[Your Rookout Token]
  1. Run the app:
pip install -r requirements.txt
python app.py
  • Optional - Run the app using Docker:
docker run -p 5000:5000 -e ROOKOUT_TOKEN=$ROOKOUT_TOKEN rookout/tutorial-python

Usage

  • Log in to the Rookout IDE.

  • Add the source code according to the instructions using the left pane Source View

    More details

    Adding source code

    1. Click on Add source
    2. Choose source control
      • Github
        • Click on Connect
        • Authorize O-Auth
        • Fill Repository Owner
        • Click Repository and choose from the dropdown menu
        • Click Next
        • Choose the desired branch
        • Click View Repository
      • Local FileSystem - Server
        • Click on Setup Server
        • Choose a supported HTTP Server
        • Follow the on-screen instructions

  • Open the file app.py

  • Add a Snapshot Breakpoint next to line number 84 by clicking next the the line number in the file viewer

  • Looking at the right-hand pane Breakpoints, you will see the Breakpoint you added, on what line you added it and it should be GREEN, meaning everything is communicating correctly.

    • If this is not the case, click here to see how to fix that
  • Go the the app webpage http://localhost:5000/ and add a todo in order to trigger the Breakpoint

  • Check the bottom pane Messages and you'll see the snapshot you just added, as it was triggered by the handler of the web api when you added a todo

Go through the bug list and follow instructions to see some basic use cases.

Common Pitfalls

  • Breakpoint status is RED -- Hash mismatch. It means the file used in the server is not the same file used from github/local server in app.rookout.com
  • Breakpoint status is GRAY -- No app connected. Make sure you have inserted the Rookout Token in the right place and that connection is made properly.

Want to learn more ?

License

APACHE 2