"Some books leave us free and some books make us free." – Ralph Waldo Emerson
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.
- Python 3.6+ for Django backend
- Node.js 6.10+ for frontend assets
Here is a quick step-by-step minimal setup, to get the app up and running in your local workstation:
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 nodeport install nodejsCreate Python virtual enviroment:
python3 -m venv venvActivate virtual enviroment (this command can change based on OS):
source kamu/bin/activateInstall backend dependencies using pip:
pip install -r requirements.txtInstall frontend dependencies using npm:
npm installCreate database tables:
python manage.py migrateCreate a super user:
python manage.py createsuperuserYou 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/*.jsonStart your local server:
npm run-script startNow 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 migrateAnother 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 migrateIn case of need authenticate without Okta preview again, execute:
unset OKTA_METADATA_URLThe 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 DJANGO_EMAIL_CRON_FROM=example@domain.comTo setup the cronjobs run:
python manage.py crontab addOnce 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 removeTo show the current jobs running execute:
python manage.py crontab showTo 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.