--- title: 'Use Supabase with Python' subtitle: 'Learn how to create a Supabase project, add some sample data to your database, and query the data from a Python app.' breadcrumb: 'Framework Quickstarts' hideToc: true --- <$Partial path="quickstart_db_setup.mdx" /> Create a new directory for your Python app and set up a virtual environment. ```bash name=Terminal mkdir my-app && cd my-app python3 -m venv venv source venv/bin/activate ``` The fastest way to get started is to use Flask for the web framework and the `supabase-py` client library which provides a convenient interface for working with Supabase from a Python app. Install both packages using pip. ```bash name=Terminal pip install flask supabase ``` Create a `.env` file in your project root and populate it with your Supabase connection variables: <$CodeTabs> ```text name=.env SUPABASE_URL= SUPABASE_PUBLISHABLE_KEY= ``` <$Partial path="api_settings_steps.mdx" variables={{ "framework": "", "tab": "" }} /> Install the `python-dotenv` package to load environment variables: ```bash pip install python-dotenv ``` Create an `app.py` file and add a route that fetches data from your `instruments` table using the Supabase client. ```python name=app.py import os from flask import Flask from supabase import create_client, Client from dotenv import load_dotenv load_dotenv() app = Flask(__name__) supabase: Client = create_client( os.environ.get("SUPABASE_URL"), os.environ.get("SUPABASE_PUBLISHABLE_KEY") ) @app.route('/') def index(): response = supabase.table('instruments').select("*").execute() instruments = response.data html = '

Instruments

    ' for instrument in instruments: html += f'
  • {instrument["name"]}
  • ' html += '
' return html if __name__ == '__main__': app.run(debug=True) ```
Run the Flask development server, go to http://localhost:5000 in a browser and you should see the list of instruments. ```bash name=Terminal python app.py ```
## Next steps - Set up [Auth](/docs/guides/auth) for your app - [Insert more data](/docs/guides/database/import-data) into your database - Upload and serve static files using [Storage](/docs/guides/storage)