Python Example setup
This repository contains the setup scripts and configuration files for how we use python in threefold/ourworld
./install.sh
This script will:
- Check if
uv
is installed (a fast Python package installer and resolver) - Install
uv
if it's not found - Initialize a uv project if
pyproject.toml
doesn't exist - Sync all project dependencies using
uv sync
- Install the herolib package from git repository
- Create necessary directories: (remove if you don't need this for your project)
static/css
,static/js
,static/images
for static assetstemplates
for HTML templatesmd
for markdown files
check how we install herolib here
pip install git+https://github.com/ThreeFoldTech/herolib.git
and also have support for the local checked out version
Running the Server
Production Mode
To start the server in production mode, run:
./start_server.sh
This script will:
- Set environment variables for production
- Check and free port 9922 if it's in use
- Start the web server on port 9922
- Make the server available at http://localhost:9922
Development/Debug Mode
To start the server in development/debug mode, run:
./start_server_debug.sh
This script will:
- Set environment variables for development
- Enable debug mode
- Check and free port 9922 if it's in use
- Start the web server on port 9922 with debug options
- Make the server available at http://localhost:9922
Environment Setup
The pipenv.sh
script is automatically sourced by the startup scripts and handles:
- Setting the PYTHONPATH to include the src directory
- Creating a virtual environment with uv if it doesn't exist
- Activating the virtual environment