@@ -8,7 +8,7 @@ TikLocal is a Flask-based web application that provides a TikTok-like interface
88
99## Key Dependencies
1010
11- - ** Backend** : Flask 3.1.0, Waitress (WSGI server)
11+ - ** Backend** : Flask 3.1.0, Waitress (WSGI server), PyYAML 6.0 (config file support)
1212- ** Frontend** : TailwindCSS v4, Feather Icons, Hammer.js
1313- ** Python** : Requires Python >=3.10,<4.0
1414- ** Package Management** : Poetry for Python dependencies, npm for CSS building
@@ -33,20 +33,29 @@ npm run build-css-prod
3333# Install dependencies
3434poetry install
3535
36- # Run the application
37- poetry run tiklocal /path/to/media/folder
36+ # Run the application (multiple ways)
37+ poetry run tiklocal /path/to/media/folder # Direct path argument
38+ poetry run tiklocal --port 9000 # Custom port with config file
39+ MEDIA_ROOT=/path tiklocal # Environment variable
40+ tiklocal # Use config file
3841
39- # Or run directly
40- python -m tiklocal.run
42+ # Configuration file (optional)
43+ # Create ~/.config/tiklocal/config.yaml:
44+ # media_root: /path/to/media
45+ # host: 0.0.0.0
46+ # port: 8000
47+
48+ # Get help
49+ tiklocal --help
4150```
4251
4352## Architecture
4453
4554### Core Application Structure
4655
4756- ** ` tiklocal/app.py ` ** : Main Flask application factory with all routes and view functions
48- - ** ` tiklocal/run.py ` ** : Entry point that starts the Waitress WSGI server on port 8000
49- - ** ` tiklocal/config.py ` ** : Configuration file (currently empty, uses environment variables )
57+ - ** ` tiklocal/run.py ` ** : CLI entry point with argument parsing, config file loading, and Waitress server startup
58+ - ** ` tiklocal/config.py ` ** : Configuration file (currently empty, configuration handled via config file/env vars )
5059
5160### Key Routes and Features
5261
@@ -74,14 +83,63 @@ python -m tiklocal.run
7483
7584### Configuration
7685
77- - ** Environment Variables** : ` MEDIA_ROOT ` (required) - path to media directory
86+ The application supports multiple configuration methods with the following priority (highest to lowest):
87+
88+ 1 . ** Command Line Arguments** : Direct arguments passed to ` tiklocal `
89+ - ` tiklocal /path/to/media ` - specify media root
90+ - ` --host HOST ` - server host (default: 0.0.0.0)
91+ - ` --port PORT ` - server port (default: 8000)
92+
93+ 2 . ** Environment Variables** :
94+ - ` MEDIA_ROOT ` - path to media directory
95+ - ` TIKLOCAL_HOST ` - server host
96+ - ` TIKLOCAL_PORT ` - server port
97+
98+ 3 . ** Configuration File** : ` ~/.config/tiklocal/config.yaml ` or ` ~/.tiklocal/config.yaml `
99+ ``` yaml
100+ media_root : /path/to/media
101+ host : 0.0.0.0
102+ port : 8000
103+ ` ` `
104+
105+ 4. **Defaults**: host=0.0.0.0, port=8000
106+
78107- **Instance Config**: Uses Flask's instance-relative configuration
79108- **Favorites**: Stored as JSON file in media root directory
80109
81110## Development Notes
82111
83- - The application uses environment variable ` MEDIA_ROOT ` to determine media location
112+ - Configuration priority: CLI args > Environment variables > Config file > Defaults
113+ - Config file locations: ` ~/.config/tiklocal/config.yaml` or `~/.tiklocal/config.yaml`
84114- Templates include responsive design optimized for mobile and tablet usage
85115- Custom Jinja2 filters for timestamp and file size formatting
86116- Error handling includes user-friendly messages and proper HTTP status codes
87- - Dark mode implementation uses CSS custom properties and data attributes
117+ - Dark mode implementation uses CSS custom properties and data attributes
118+
119+ # # Release Process
120+
121+ When publishing a new version to PyPI :
122+
123+ 1. **Update version number** in `pyproject.toml` :
124+ ` ` ` toml
125+ version = "x.y.z"
126+ ` ` `
127+
128+ 2. **Commit changes** :
129+ ` ` ` bash
130+ git add .
131+ git commit -m "Release vx.y.z: description of changes"
132+ ` ` `
133+
134+ 3. **Create and push git tag** (required for PyPI build) :
135+ ` ` ` bash
136+ git tag -a vx.y.z -m "Release vx.y.z: description"
137+ git push origin vx.y.z
138+ ` ` `
139+
140+ 4. **Push commits** :
141+ ` ` ` bash
142+ git push
143+ ` ` `
144+
145+ **Note**: The git tag triggers the CI/CD pipeline to automatically build and publish to PyPI.
0 commit comments