This section contains information for integrating and configuring the Python Snapshot Debugger agent in different environments. Full configuration information for the agent can be found at Python Agent Documentation
See samples/python for working examples of installing and configuring the Python agent across different Google Cloud environments.
It's also possible to run things outside of a Google Cloud environment, such as locally. Here are some notes for doing so, which involves generating a service account key so the agents are able to read/write from the Firebase RTDB backend.
-
Navigate to your project in the Firebase console service account page. Replace
PROJECT_ID
with your project’s ID.https://console.firebase.google.com/project/PROJECT_ID/settings/serviceaccounts/adminsdk
-
Click Generate new private key and save the key locally.
-
Download the Debugger agent.
The easiest way to install the Python Debugger is with pip
pip install google-python-cloud-debugger
-
Add the following lines as early as possible in your initialization code, such as in your main function, or in manage.py when using the Django web framework.
try: import googleclouddebugger googleclouddebugger.enable( use_firebase=True, module='[MODULE]', version='[VERSION]', service_account_json_file='[PATH-TO-KEY-FILE]' ) except ImportError: pass
Where:
MODULE
is a name for your app, such as MyApp, Backend, or Frontend.VERSION
is a version, such as v1.0, build_147, or v20170714.PATH-TO-KEY-FILE
is the path to your Firebase private key.