blog/README.md
2023-07-11 10:04:58 +00:00

16 lines
1.2 KiB
Markdown

## Development
From the root directory, run `pip install -r requirements.txt` to install the package (and all dependencies) in editable mode.
Use `flask --app flaskr run` to run app. The package will be updated as you edit files.
## Production
Run `python -m build --wheel` to generate the wheel, and install the wheel (found in `dist/`) in the production environment.
Use `flask --app flaskr run` to run app. To update package, you will need to install a new wheel.
## Initializing database
The first time you install the app in each environment, you need to initialize database using `flask --app flaskr init-db`. This only needs to be run once per environment, and **will delete existing database if run again**.
## Secret key
Every website with login needs a secret key to hash passwords with.
`<python_environment>/var/flaskr-instance/config.py` must contain a line `SECRET_KEY = '<secret_key>`, which must be randomly generated.
Suggested way of generating the key is `python -c 'import secrets; print(secrets.token_hex())'`, which returns a hexadecimal string with length 64. You may choose to randomly generate a key using a different method, but ensure that it is resistant to brute-force attacks.