Skip to content

danielcn/kamu

 
 

Repository files navigation

Kamu

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

CircleCI

Test Coverage

Code Climate

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

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

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 kamu/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

Running and configuring cronjobs

The cronjobs use Unix's crontabs, so it doesn't run on Windows systems.

If you want to run the cronjobs you need to configure the following environment variables, used to send the email reminders:

export DJANGO_EMAIL_HOST=localhost
export DJANGO_EMAIL_PORT=2525
export DJANGO_EMAIL_TIMEOUT=1
export [email protected]

To setup the cronjobs run:

python manage.py crontab add

Once you run that command it will register the cronjob with a hash. The SO will begin to execute the job according to the configuration, even if you shutdown the machine, when you start it again the cronjobs will begin to execute again.

To remove (and stop) the jobs execute:

python manage.py crontab remove

To show the current jobs running execute:

python manage.py crontab show

To run immediately execute:

python manage.py crontab run hash-of-the-cronjob

If there's a problem during the job execution it will create a text in /var/mail/username that contain the error message. Most errors will come because the env vars are not set globally, due to the fact that crontab run in its own session.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 52.1%
  • Python 39.3%
  • CSS 5.9%
  • HTML 1.4%
  • Shell 1.2%
  • Makefile 0.1%