gut0w / kamu

You favorite book library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kamu

"Some books leave us free and some books make us free." – Ralph Waldo Emerson

Build Status Test Coverage Maintainability

Join the Telegram contributors chat at https://t.me/joinchat/AfhaV0XSlMRVFfS4rZaVAw

Kamu is an application that focus on managing a physical library where you can add books, borrow and return them.

In the main page you can see the libraries shared between users. The libraries can be different unities, cities or name of friends that wants to share books. In the Screenshoot bellow, you can see an example of multiple libraries.

Screenshoot for Kamu's multiple libraries

Requirements

  • Python 3.6+ for Django backend
  • Node.js 6.10+ for frontend assets

Installation / Getting started

Here is a quick step-by-step minimal setup, to get the app up and running in your local workstation:

MacOS specific

To install node.js and its package manager npm you can either download it from the node.js homepage or use a package manager like:

brew install node
port install nodejs

Platform independent

Create Python virtual enviroment:

python3 -m venv venv

Activate virtual enviroment (this command can change based on OS):

source venv/bin/activate

Install backend dependencies using pip:

pip install -r requirements.txt

Install frontend dependencies using npm:

npm install

Create database tables:

python manage.py migrate

Create a super user:

python manage.py createsuperuser

You will use this super user to login as administrator in your local kamu application.

Seed the database with initial dump data:

python manage.py loaddata dump_data/*.json

Start your local server:

npm run-script start

Now just go to http://localhost:8000 in your browser :)

For setup local with authenticate with Okta Preview: Use the "OKTA_METADATA_URL='url-of-okta-saml'" concatenating with the python's commands:

  Examples:
  OKTA_METADATA_URL='url-of-okta-saml' npm run-script start
  OKTA_METADATA_URL='url-of-okta-saml' python manage.py migrate

Another way is to export the var and then execute the commands:

  export OKTA_METADATA_URL='url-of-okta-saml'
  npm run-script start
  python manage.py migrate

In case of need authenticate without Okta preview again, execute:

  unset OKTA_METADATA_URL

Executing using docker for local development

We now support Docker =), just go to your favorite console and type:

cd docker
docker-compose build
docker-compose up

Deployment

We have out of the box support for Heroku 🐉 and Dokku 🐳

For deployment, create a new Python app and set the remote origin from Dokku or Heroku, push it and enable the Postgres plugin.

The buildpacks should configure all the necessary libraries for you.

Now, we need the following environment variables before running Kamu for the first time:

SECRET_KEY="django-secret-key" # https://duckduckgo.com/?q=django+secret+key+generator
DEBUG="true" # Or false, depending if is a testing or production app
DJANGO_SETTINGS_MODULE="kamu.prod_settings" # If you plan to run a testing version with sqlite, this is not necessary
DATABASE_URL="" # This variable should be automatically configured by the postgres extension. See prod_settings.py for reference.
ALLOWED_HOSTS="kamu.example.com" # At this moment, only one domain is supported
OKTA_METADATA_URL="SECRET-OKTA-STUFF" # On the case of Okta Authentication support 

See Dokku environment variables or Heroku Config Vars for more details.

On non Okta based deployments, you should run either dokku run kamu /bin/bash or heroku run /bin/bash -a kamu (On this case, kamu is app name)

python manage.py createsuperuser

See #74

Thanks!

About

You favorite book library

License:MIT License


Languages

Language:Python 46.9%Language:JavaScript 44.4%Language:CSS 5.1%Language:HTML 1.7%Language:Shell 1.0%Language:Dockerfile 0.7%Language:Makefile 0.1%