What gets measured gets managed. - Peter Drucker
Our simple yet effective reading tracking app: PyBites Books
(Warning: it can be addictive and will cause you to read more!)
- Create a virtual env and activate it (
source venv/bin/activate
) - Install the dependencies:
pip install -r requirements.txt
- Create a database, e.g.
pybites_books
and define the full DB URL for the next step, e.g.DATABASE_URL=postgres://postgres:[email protected]:5432/pybites_books
. - Set this env variable together with
SECRET_KEY
in a file called.env
in the root of the project:cp .env-template .env && vi .env
. That's the bare minium. If you want to have email working create a Sendgrid account obtaining an API key. Same for Slack integration, this requires aSLACK_VERIFICATION_TOKEN
. The other variables have sensible defaults. - Sync the DB:
python manage.py migrate
. - And finally run the app server:
python manage.py runserver
.
You can use docker / docker compose to run both the postgresql database as well as the app itself. This makes local testing a lot easier, and allows you to worry less about environmental details.
To run, simply run the below command. This should spin up the db, and then the application which you can reach at http://0.0.0.0:8000.
docker-compose rm && docker-compose build && docker-compose up
In order to prevent recreating the DB every time you run docker-compose, and in order to keep state from use to use, a volume is mounted, and tied to the local directory database-data. This is ignored in the .gitignore so that you don't accidentally upload data to github.
This has environment variables set so that you can get up and running easily. Tweak these as needed to add things like Slack and SendGrid integration.
... are more than welcome, just open an issue and/or PR new features.
Love books, join our Slack #books channel.
Remember leaders are readers, read every day!