-
Notifications
You must be signed in to change notification settings - Fork 21
Setup
First, install Coldsweat with pip
like explained in the main Readme file or clone the repository into your installation directory.
Coldsweat to run needs two information:
- Which database backend to use and where to store data. See Peewee's Database URL examples to configure your database of choice.
- Which secret key to use when generating session cookies to keep web users logged-in. See Flask documentation about secret keys on tips to pick secure values.
Such information can be specified in two ways.
By adding a config.toml
file, using the TOML format. This boils down to write a series of key-value pairs like the example below:
DATABASE_URL="mysql://username:[email protected]:3306/coldsweat"
SECRET_KEY="192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf"
The config.toml
file is loaded from the Flask instance_path
, which for an installed package can be one of these values:
$PREFIX/lib/pythonX.Y/site-packages/coldsweat
$PREFIX/var/coldsweat-instance
Where $PREFIX
is the prefix of your Python installation. This can be /usr
or the path to your virtualenv. You can print the value of sys.prefix to see what the prefix is set to.
See Flask documentation on instance folders for more info.
Another approach is using environment variables and assign their values to names prefixed by FLASK_
:
export FLASK_DATABASE_URL="mysql://username:[email protected]:3306/coldsweat"
export FLASK_SECRET_KEY="192b9bdd22ab9ed4d12e236c78afcb9a393ec15f71bbf5dc987d54727823bcbf"
In the current implementation config.toml
file is checked first, then if it cannot be found the environment variables are looked up. Finally if a DATABASE_URL
setting cannot be found Coldsweat creates a sqlite database into Flask app.instance_path
directory and uses a weak SECRET_KEY
solely to get you started.
The last step is like that to make development easier: when you checkout the repo the default database will be created in the instance
directory next to the coldsweat
package.
Please take look at the Deploy page.