From 52c4c5c3a4a3597ba75637ab172c18b9c744dcd7 Mon Sep 17 00:00:00 2001 From: mystieneko Date: Thu, 29 Aug 2024 19:43:21 +0300 Subject: [PATCH] improved README instructions --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 31cda5a..6057fb0 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,55 @@ # CatAsk -## Installation +a work-in-progress minimal single-user q&a software + +## Install Clone this repository: `git clone https://git.gay/mst/catask.git` + ### VPS-specific Go into the cloned repository, create a virtual environment and activate it: -```python -m venv venv && . venv/bin/activate``` -Install required packages: + +#### Linux +```python -m venv venv && . venv/bin/activate``` + +#### Windows (PowerShell) +```python -m venv venv; .\venv\Scripts\activate``` + +--- + +After that, install required packages: ```pip install -r requirements.txt``` + ### Shared hosting-specific If your shared hosting provider supports [WSGI](https://w.wiki/_vTN2), [FastCGI](https://w.wiki/9EeQ), or something similar, use it (technically any CGI protocol could work) -## Post-installation -Create a MySQL/MariaDB database and connect MDFlare to it (in `.env` file) -Then init the database: `flask init-db` -If that doesn't work, try importing schema.sql into the created database manually +## Post-install -Rename `.env.example` to `.env`, configure all values there, and edit variable `fullBaseUrl` in `config.py` file -Then run it: -`flask run` or `gunicorn -w 4 app:app` (if you have gunicorn installed) or `python3 app.py` -If you want it to be accessible on a specific host address, specify a `--host` option (e.g. `--host 0.0.0.0`) to `flask run` +## Configuration + +First, rename `.env.example` to `.env`, then configure all the values below: + +### .env +`DB_HOST` - database host (usually 127.0.0.1) +`DB_NAME` - database name +`DB_USER` - database user +`DB_PASS` - database password +`ADMIN_PASSWORD` - password to access admin panel +`APP_SECRET` - application secret, generate one with this command: `python -c 'import secrets; print(secrets.token_hex())'` + +### config.py +`instanceTitle` - title of CatAsk instance +`instanceDesc` - description of CatAsk instance +`fullBaseUrl` - full base URL to CatAsk instance, e.g. `https://ask.example.com` + +--- + +After you're done configuring CatAsk, init the database: `flask init-db` +If that doesn't work (e.g. tables are missing), try importing schema.sql into the created database manually ## Usage -Works on `127.0.0.1:5000` (`flask run` or `python app.py`) or `127.0.0.1:8000` (`gunicorn -w 4 app:app`), may work in a production environment \ No newline at end of file + +Use one of these commands to run CatAsk: `flask run` or `gunicorn -w 4 app:app` (if you have gunicorn installed) or `python app.py` +If you want CatAsk to be accessible on a specific host address, specify a `--host` option to `flask run` (e.g. `--host 0.0.0.0`) + +Admin login page is located at `https:///admin/login/` +Runs on `127.0.0.1:5000` (`flask run` or `python app.py`) or `127.0.0.1:8000` (`gunicorn -w 4 app:app`), may work in a production environment