-
Notifications
You must be signed in to change notification settings - Fork 0
Local Development Setup
A guide to setting up and using VM Lab in a local environment.
Note
Approach recommended for the developement environment.
VM Lab development works with popular Python IDEs, like:
Ensure you have the following installed on your machine:
Warning
You must use the Python Version 3.12.
The latest minor version that I've tested is the number 9, but I'm not sure if it works even for the numbers above it.
Also, ensure that the two modules are active before building the main app:
-
Clone the VM Lab main repository to your machine.
git clone https://github.com/isislab-unisa/vm-lab.git
-
Connect to PostgreSQL using either of the following methods:
-
psqlcommand line tool.psql -U <user>
- PyCharm's query console (after defining the PostgreSQL data source).
-
-
Create the database by executing this query:
CREATE DATABASE "vm-lab" WITH OWNER = postgres -- or another user ENCODING = 'UTF8' LOCALE_PROVIDER = 'libc' -- omit this on Windows CONNECTION LIMIT = -1 -- omit this on Windows IS_TEMPLATE = False;
-
Create the tables by running the
init-db.sqlscript, or pasting its content directly into your SQL console.psql -U <user> -d "vm-lab" -f "path\to\init-db.sql"
-
Create the Python Virtual Environment:
python -m venv .venv
-
Activate the Python Virtual Environment.
Linux/macOS:
source .venv/bin/activateWindows PowerShell:
.venv\Scripts\Activate.ps1
-
Install the project dependencies from the
requirements.txtfile:pip install -r requirements.txt
-
Edit the
first_users.yamlfile to define initial users.first_users: # Example User 1 - username: jsmith email: [email protected] first_name: John last_name: Smith password: abc role: admin # Example User 2 - username: rbriggs email: [email protected] first_name: Rebecca last_name: Briggs password: def role: regular
Caution
Add at least an admin.
Warning
Do not include sensitive credentials. Use simple default values and change them later via the system UI.
- Edit
template_secrets.tomlto match your local environment (e.g., database user, password, etc.).
Note
For more information on how to generate the keys, see here.
-
Rename the
template_secrets.tomlfile tosecrets.tomland move it to the.streamlitfolder.mv template_secrets.toml .streamlit/secrets.toml
You can run the application in several ways.
Tip
On the first run, when it promts for an email, press enter.
Run the app directly with Streamlit:
streamlit run app.pyUse the provided platform-specific scripts to activate the environment and run the app.
Linux/macOS:
./run_unix.shWindows:
run_windows.batIf you're using PyCharm, select the "Streamlit Run App" configuration found in the .idea directory.

- Official Streamlit Documentation
- Other Modules: