.. author:: Torben <https://entorb.net/contact.php?origin=UberspaceLab>
.. tag:: lang-python
.. tag:: streamlit
.. tag:: web
.. tag:: audience-developers
.. tag_list::
Streamlit is a high-level Python Web framework focussing on data visualization.
Note
For this guide, you should be familiar with the basic concepts of
- :manual:`Python <lang-python>` and its package manager pip
- :manual:`Supervisord <daemons-supervisord>` to set up your service
All relevant legal information can be found in the terms of use.
Your URL needs to be setup:
For this guide we will use mysiteproject as the project's name and will install it to ~/mysiteproject
.
Install the latest Streamlit version.
[isabell@stardust ~]$ pip3.11 install --user streamlit
[isabell@stardust ~]$
Create a directory for your project. We use ~/mysiteproject for this guide.
[isabell@stardust ~]$ mkdir ~/mysiteproject
[isabell@stardust ~]$ mkdir ~/mysiteproject/.streamlit
[isabell@stardust ~]$
Warning
While it does not matter how you name it and where you put it, we suggest that you do not put this directory under any path served to the web (e.g. ~/html
), to avoid exposing your files.
Create ~/mysiteproject/.streamlit/config.toml
[browser]
gatherUsageStats = false
[server]
headless = true
port = 8501
baseUrlPath = ""
See Streamlit configuration documentation for more information.
Create ~/mysiteproject/app.py
import streamlit as st
st.title("Test")
Note
Streamlit is running on port 8501.
Create ~/etc/services.d/mysiteproject.ini
with the following content:
[program:mysiteproject]
directory=%(ENV_HOME)s/mysiteproject
command=streamlit run app.py
After creating the configuration, tell :manual:`supervisord <daemons-supervisord>` to refresh its configuration and start the service.
Note
Streamlit is running on port 8501.
Your backend should now point to the service.
Tested with Streamlit 1.40.2, Python 3.11, Uberspace 7.16
.. author_list::