# onionvote Vote for the best .onion (or any other kind of text) --- ## Installation Prepare: - Python 3 - A directory with entries. Entries are the names of files or folders in that directory. 1. Clone this repo and enter it ```bash git clone https://git.m724.eu/Minecon724/onionvote cd onionvote ``` 2. Create a virtualenv and enter it: ```bash python3 -m venv .venv . .venv/bin/activate ``` 3. Install: ```bash pip install -e . ``` 4. Prepare the database: ```bash flask --app onionvote init-db flask --app onionvote populate-db entries/ # replace with your entries directory ``` 5. Run the app in **Debug mode, not for production**: ```bash flask --app onionvote run --debug ``` ### Running in production Follow the [Installation](#Installation) steps, then: 1. Generate a secret key: (not required, but best practice) ```bash python -c 'import secrets; print(secrets.token_hex())' ``` 2. Create a file in `.venv/var/onionvote-instance/config.py` with content: ```python SECRET_KEY = '' ``` 3. Install the [web server:](https://docs.pylonsproject.org/projects/waitress/en/stable/) ```bash pip install waitress ``` 4. Run it: ```bash waitress-serve --call 'onionvote:create_app' ``` 5. Get a reverse proxy to handle the rest. This was just an example, there are many ways to deploy a Flask app. See https://flask.palletsprojects.com/en/stable/deploying/ ## Security [Flask sessions](https://flask.palletsprojects.com/en/stable/quickstart/#sessions) are used to make it harder to skew results. (e.g. pick your own pairs and vote many times) \ This uses a cookie that's stored on visit and removed when the browser is closed.