Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ElthonJohan/Sistema-MRP/llms.txt

Use this file to discover all available pages before exploring further.

Sistema MRP uses two configuration mechanisms: Streamlit secrets (.streamlit/secrets.toml) for deployed environments, and a .env file for local development. Both set the same DATABASE_URL variable — the application checks Streamlit secrets first and falls back to the environment variable loaded from .env.

Database URL

database.py resolves the database connection string using the following priority order:
  1. st.secrets["DATABASE_URL"] — checked first; available in Streamlit Cloud and any deployment that provides Streamlit secrets.
  2. The DATABASE_URL environment variable loaded from a .env file via python-dotenv.
If neither source provides the value, the application raises a ValueError at startup and will not run.
Streamlit secrets always take priority over .env. If you set DATABASE_URL in both places, the value in .streamlit/secrets.toml wins.

Setting DATABASE_URL in a .env file

Create a .env file in the project root (next to app.py):
.env
DATABASE_URL=sqlite:///./mrp.db
The SQLite database file (mrp.db) is created in the project root the first time init_db.py runs. No server or additional software is required.

Setting DATABASE_URL in Streamlit secrets

For Streamlit Cloud deployments, add the variable in your app’s Secrets settings, or create .streamlit/secrets.toml locally:
.streamlit/secrets.toml
DATABASE_URL = "postgresql://user:pass@host/dbname"

PostgreSQL connection pool

When the DATABASE_URL starts with postgresql, database.py creates the SQLAlchemy engine with the following settings:
database.py
engine = create_engine(
    DATABASE_URL,
    echo=False,
    pool_pre_ping=True,
    pool_size=5,
    max_overflow=10,
    connect_args={"sslmode": "require"},
)
sslmode=require is enforced for all PostgreSQL connections. The psycopg2-binary package (included in requirements.txt) must be installed for PostgreSQL support.

Streamlit configuration

The .streamlit/config.toml file controls the visual appearance and runtime behavior of the Streamlit application. The full file as shipped:
.streamlit/config.toml
[client]
showErrorDetails = true
toolbarMode = "minimal"

[logger]
level = "error"

[ui]
hideTopBar = true
hideSidebar = false

[theme]
base              = "dark"
primaryColor      = "#2563eb"
backgroundColor   = "#0f172a"
secondaryBackgroundColor = "#1e293b"
textColor         = "#e2e8f0"
font              = "sans serif"

Settings reference

SettingValueNotes
client.toolbarMode"minimal"Reduces the Streamlit toolbar to its minimum state
ui.hideTopBartrueHides the top bar in the Streamlit UI
logger.level"error"Suppresses info and warning logs from the Streamlit logger
theme.primaryColor#2563ebBlue accent used for buttons and interactive elements
theme.base"dark"Dark theme base; all color overrides build on this
theme.backgroundColor#0f172aMain page background
theme.secondaryBackgroundColor#1e293bSidebar and widget background
theme.textColor#e2e8f0Primary text color

Settings you should not change

Do not change server.headless or browser.gatherUsageStats without fully understanding the deployment context. These settings affect how Streamlit behaves in headless server environments and may break deployed instances if modified incorrectly.
The theme block is safe to customize for branding purposes. The primaryColor (#2563eb) is the primary brand color used throughout the interface — if you change it, update any hardcoded hex values in utils/theme.py as well.

Build docs developers (and LLMs) love