diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..3295d31 --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +DB_HOST = 127.0.0.1 +DB_NAME = catask +DB_USER = +DB_PASS = +ADMIN_PASSWORD = +APP_SECRET = \ No newline at end of file diff --git a/README.md b/README.md index 83447fb..31cda5a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ -# catask-server +# CatAsk +## Installation +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: +```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 + +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` + +## 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 diff --git a/app.py b/app.py index ecc623f..f19014e 100644 --- a/app.py +++ b/app.py @@ -15,7 +15,8 @@ logged_in = False load_dotenv() app = Flask(cfg.appName) -app.config["SECRET_KEY"] = os.environ.get("APP_SECRET") +print(os.environ.get("APP_SECRET")) +app.secret_key = os.environ.get("APP_SECRET") # -- blueprints -- api_bp = Blueprint('api', cfg.appName) diff --git a/constants.py b/constants.py index 418de18..269c8a5 100644 --- a/constants.py +++ b/constants.py @@ -1,3 +1,3 @@ antiSpamFile = 'wordlist.txt' blacklistFile = 'word_blacklist.txt' -version = '0.1.0' +version = '0.1.1' diff --git a/requirements.txt b/requirements.txt index 62cb824..bf78b03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ flask python-dotenv mysql-connector-python==8.2.0 +humanize \ No newline at end of file diff --git a/templates/admin/login.html b/templates/admin/login.html index dcebafa..65cae07 100644 --- a/templates/admin/login.html +++ b/templates/admin/login.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} - +{% block title %}Admin Login{% endblock %} {% block content %}