Takk

Deploy

Streamlit

This guide walks you through deploying a Streamlit application on Takk. Streamlit is a popular framework for building data apps and dashboards in Python. Takk has first-class support for Streamlit with the StreamlitApp configuration.

Prerequisites

Make sure you have the Takk CLI installed and are logged in. If not, follow the Get Started guide first.

Create the Project

Start by creating a new directory and initializing it:

bash
mkdir streamlit-hello
cd streamlit-hello
uv init

Add your dependencies:

bash
uv add streamlit takk

Write the Application

Create app.py with a minimal Streamlit application. All Streamlit logic must live inside a function that Takk uses as the entrypoint:

python
import streamlit as st

def main():
    st.title("Hello, World!")
    st.write("Welcome to my Streamlit app deployed on Takk.")

    name = st.text_input("What's your name?")

    if name:
        st.write(f"Hello, {name}!")

Define the Project

Create project.py to tell Takk how to run your Streamlit app:

python
from takk.models import Project, StreamlitApp
from app import main

project = Project(
    name="streamlit-hello",
    server=StreamlitApp(main),
)

Takk uses the StreamlitApp type to automatically configure the Streamlit server, handle networking, and set up TLS. The function you pass is the entrypoint that Takk calls to run your app.

Run Locally

Start the local development environment:

bash
uv run takk up

Your Streamlit app is now running at http://localhost:8501. Open it in your browser to see the interactive dashboard.

Changes to your code are automatically reloaded while takk up is running.

Deploy

Deploy to the cloud with:

bash
uv run takk deploy

Takk builds the container, provisions infrastructure, and starts your Streamlit application. TLS, networking, and scaling are handled automatically.

Next Steps

Previous
Flask