https://github.com/davis-software/swc_pages
Lightweight package-based webserver
https://github.com/davis-software/swc_pages
Last synced: about 1 month ago
JSON representation
Lightweight package-based webserver
- Host: GitHub
- URL: https://github.com/davis-software/swc_pages
- Owner: Davis-Software
- License: mit
- Created: 2022-08-23T12:14:41.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T20:36:17.000Z (over 3 years ago)
- Last Synced: 2025-01-01T20:46:23.778Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### SWC_pages
> Developed by [Davis_Software](https://github.com/Davis-Software) © 2022
> Demo: [Davis_Software Homepage](https://pages.software-city.org)
---
Lightweight package-based webserver
Basically Software City's version of [GitHub Pages](https://pages.github.com/) with some special features but also a lot less functionality.
### Development
```shell
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 app.py
```
### config.ini
###### Default:
```
# app config
SECRET_KEY=
# webserver config
HOST=0.0.0.0
PORT=80
DEBUG=true
# routing config
DEFAULT_PAGE=test_website
ALLOW_LIST=true
```
###### Explanation:
| Parameter | Description |
|-------------------|----------------------------------------------------|
| SECRET_KEY | Flask session secret key |
| HOST | Host to listen on |
| PORT | Port to listen on |
| DEBUG | Enable debug mode |
| DEFAULT_PAGE | ID of Default page to show if no page is specified |
| ALLOW_LIST | Enable allow list |
| WATCH_FOR_CHANGES | Enable automatic page reload on file change |
### Routing
| Route | Description |
|--------------------------------------|---------------------------------------------------|
| `/` and `/d` | Default page |
| `/j/` and `/join/` | Join page by id |
| `/list` | List of all pages (Must be enabled in config.ini) |
* Once a page is joined by id, it will be remembered in the session cookie and will be shown by default.
### Installing pages
Pages are installed by placing them in the `packages` folder.
The page must be a zip file containing a `manifest.json` file and all other website files:
Folders are allowed and will be accessible through the route `/`.
When the server is started, the pages will be extracted to the `package_cache` folder.
This overwrites the old files, so if you want to update a page, you have to edit the zip file.
* demo.zip
* \
* index.html
* manifest.json
###### manifest.json
```json
{
"name": "Demo",
"description": "Demo page",
"author": "Davis_Software",
"version": "1.0.0",
"id": "demo",
"entry": "index.html" // entry point of the page
}
```