Skip to content

Latest commit

 

History

History

flask-sqlalchemy

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Logfire + Flask + SQLAlchemy Example

This example is a simple Python financial calculator app which is instrumented with Logfire. If you spin up the server locally and interact with the calculator app, you'll be able to see traces come in automatically. The Logfire instrumentation is done with just a few lines of code in main.py.

Run the project

Clone the repository, navigate to it, setup a virtual environment, and install the dependencies:

git clone https://github.com/pydantic/logfire.git
cd examples/python/flask-sqlalchemy
python -m venv venv
source venv/bin/activate
pip install 'logfire[sqlalchemy,flask]' flask-sqlalchemy

If you don't have a Logfire account, create a free one in Logfire. Then authenticate Logfire locally:

logfire auth

Run the main.py file:

python main.py

Now you should see

In order to see traces arrive in the Logfire app, interact with the local calculator app (click around, enter values into the fields, click calculate)